如何使< div>填充< td>高度 [英] How to make <div> fill <td> height
问题描述
此问题的答案需要更新,因为浏览器已更改。
原始问题
我已经看过StackOverflow上的几个帖子,但是没能找到这个相当简单的问题的答案。
I've looked through several posts on StackOverflow, but haven't been able to find an answer to this rather simple question.
我有一个这样的HTML结构:
I have an HTML construct like this:
<table>
<tr>
<td class="thatSetsABackground">
<div class="thatSetsABackgroundWithAnIcon">
<dl>
<dt>yada
</dt>
<dd>yada
</dd>
</dl>
<div>
</td>
<td class="thatSetsABackground">
<div class="thatSetsABackgroundWithAnIcon">
<dl>
<dt>yada
</dt>
<dd>yada
</dd>
</dl>
<div>
</td>
</tr>
</table>
我需要的是 div
填充 td
的高度,因此我可以将div的背景(图标)放置在 td
。
What I need is for the div
to fill the height of the td
, so I can be able to position the div's background (the icon) at the bottom-right corner of the td
.
如何建议我这样做?
推荐答案
如果你给你的TD的1px的高度,那么子div将有一个高的父级计算它的%from。因为你的内容将大于1px,td会自动增长,就像div。 Kinda一个垃圾黑客,但我敢打赌它会工作。
If you give your TD a height of 1px, then the child div would have a heighted parent to calculate it's % from. Because your contents would be larger then 1px, the td would automatically grow, as would the div. Kinda a garbage hack, but I bet it would work.
这篇关于如何使< div>填充< td>高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!