如何制作<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 将有一个高度的父级来计算它的百分比.因为您的内容会大于 1px,所以 td 会自动增长,div 也是如此.有点垃圾黑客,但我打赌它会起作用.
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屋!