开发者

How to align one div to the top and another to the botton of the same cell?

I'm trying to create a 2 column layout w/ a divder inbetween the columns. My problem is w/ the divider I wish to make. I have markup like the following:

<div style="display:table">

    <!--Left Column-->
    <div class = "cell" style="min-width:200px;">            
       ...content
    </div>

    <!--Divider Column-->
    <div class="cell vr">            
        <div class="t"></div>
        <div class="b"></div>
    </div>

    <!--Right Column-->
    <div class="cell" style="width:100%;">            
       ...content
    </div>

</div>

CSS:

div.cell  { display:table-cell; overflow:hidden;vertical-align:top;}
    /*Vertical Rule*/
    .vr    {background:url(Img/vGradient.png) repeat-y; width:6px; position:relative;}  /*Vertical Rule Gradient*/
    .vr .t {background:url(Img/vGradientT.png) repeat-x; width:6px; height:50px; position:absolute; top:0;} /*Top Of Rule*/
    .vr .b {background:url(Img/vGradientB.png) repeat-x; width:6px; height:50px; position:absolute; bottom:0;} /*Bottom Of Rule*/

So I'm tr开发者_运维知识库ying to get the middle cell to have a background image along its full height and then have the top image overlap on top of it at the top and the bottom image of the divider overlap it at the bottom of the cell.

Haven't been able to make it work though. Can this be done?

UPDATE: This works...but it forces me to assign a height rather than have the divider be as tall as the table needs to be....

<div class="cell">        
        <div class="vr" style="height:300px">
            <div class="t"></div>
            <div class="b"></div>
        </div>
    </div>


try to set height for .vr class, sometimes not having height defined couses problems.

   .vr    {background:url(Img/vGradient.png) repeat-y; width:6px;  height:300px; position:relative;}  /*Vertical Rule Gradient*/ 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜