As my table row grows in height, I’d like my div inside to automatically match it as well.
For the code above, my div‘s height is always 0.
I understand that the height:inherit only works when you explicitly state the height of the parent (<td>) but I don’t want to do that because I have no idea what content height will be displayed there.
Is there any css trick to do this or do I have to resort to some JS?
You cannot using a
heightrule, but you can still achieve the effect you’re after by positioning the div absolutely. Since this changes the layout of the div, you will then have to apply the width to thetdinstead:Here’s your fiddle: http://jsfiddle.net/ZAvDd/2/