全高度div在td [英] Full height div inside td

查看:314
本文介绍了全高度div在td的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现这个目的:



表格行和灰色行的高度应该是动态的,具体取决于右列中的内容。



我已经阅读了如何使< div>填充< td> height ,因此我尝试使用此 http://jsfiddle.net/hyNWy/ p>

但还是没有运气。有任何建议吗?

解决方案

有冒号吗?此外,要获取您的间距:

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



编辑:



认为可能没有指定明确的高度。您指向的原始问题中的解决方案实际上不起作用。 position:relative 似乎不能正确应用于表格单元格。这可能是有意的和规范的一部分。


I want to achieve this thing:

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

I've read in How to make <div> fill <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.

这篇关于全高度div在td的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆