Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is table cell height calculated?

After a couple of days spent struggling with HTML tables, my forehead has a grid of indents which incidentally are a mirror copy of my keyboard.

Speaking of grids, I'd like to know if there's any set of rules regarding <td> size.

Is it all according to the content? Is it affected by other cells in the same row? By the row itself? By the table? Plain ol' CSS?

NOTE: I'm specifically not looking for an answer to a specific question.
I just want to know how the darned height is calculated so I can figure out myself each time what to expect.

like image 305
Yehuda Shapira Avatar asked Mar 28 '26 00:03

Yehuda Shapira


1 Answers

Yes table cells follows the content and it's siblings height.

You can say that it's a rectangle split in section, that no matter what it's inside it will always stay as a rectangle.

So even if you add a css height it will ignore it if the text is bigger than the css height.

So pretty much you can expect a dynamic height in most case scenarios.

But still...it should be used to show only tabular data and nothing else. For the rest there is display:table-cell;...

like image 98
drip Avatar answered Apr 01 '26 08:04

drip



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!