开发者

Full height div inside td

开发者 https://www.devze.com 2023-01-18 08:25 出处:网络
I want to achieve this thing: Height of table row and grey line should be dynamic depend on contents in right column.

I want to achieve this thing:

Full height div inside td

Height of table row and grey line should be dynamic depend on contents in right column.

I've read in How to make <div> fi开发者_如何学Cll <td> height, so I tried with this http://jsfiddle.net/hyNWy/

But still no luck. Any suggestions?


With a colon? Also, to get your spacing:

<td style="position:relative;">
    <div style="width: 10px; position:absolute; top:10px; bottom:10px; background:grey">
    </div>
</td>

EDIT:

I don't think it's possible without specifying an explicit height. The solution in the original question that you pointed to does not actually work. position:relative does not seem to apply correctly to table cells. This could well be intentional and part of the spec.


Did you try

<table>
    <tr>
        <td>
            <div>
            </div>
        </td>
    </tr>
</table>

with

tr {  }
td { position:relative;height:300px; display:block; }
div {
    width:10px;
    position:absolute;
    bottom:10px;
    top:10px;
    display:block;
    background:grey
}

Here's a jsfiddle of that.

0

精彩评论

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

关注公众号