English 中文(简体)
CSS:如何实现两栏顶高度,使其与最大内容相匹配?
原标题:CSS: How do achieve two column heights that match the height of the column with the most content?

我从我的网站上抽取了密码,并做了简化, j忙地描述我的问题。

rel=“nofollow”>http://jsfiddle.net/5vMHC/3/


So what I m tryin to do is have a border line seperating the left column from the right column, however I want the line to stretch to the height of the column with the most content. The way I have it setup now, I put border-left on the right column content, so if the content is smaller than the content in the left column, it only stretches to the height of the right column.

我怎么能够把它拖到最漫长的内容? 我是否必须使这两栏都与最长的栏数相等? 我如何这样做? 我的html结构吗? 感谢!

最佳回答

这样做最容易的办法是在边界上添加一个<条码>填满器/代码>的类型元素,并将其置于绝对的位置:

.filler {
    border-right:1px solid #CDE;
    width: 209px;                   /* width of #sub_page_left_column */
    position: absolute;
    bottom: 0;
    top: 0;
}

/* add position relative so filler is positioned in respect to this div */
#content {
    ....
    position: relative;           
    ....
}

<div id="content">
    <!-- add the new filler element -->
    <div class="filler"></div>  
    <div id="sub_page_left_column">...</div>
    <div id="sub_page_right_column">...</div>
</div>        

rel=“nofollow”http://jsfiddle.net/5vMHC/5/。

http://jsfiddle.net/5vMHC/6/“rel=“nofollow”http://jsfiddle.net/5vMHC/6/。

问题回答

实现您的目标没有简单明了。

读到article时,你将学习四种可能的方法,然后由您决定项目的最佳方式。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签