XmarinusX
XmarinusX

Reputation: 33

Minimum height for each cell HTML table

I've got a table with 3 cells and 1 row. I get the text to show in the cells out of a database, and my question is: How can I use a minimum height for all three cells? So they're not all the same height. As the middle column will be a bigger.

Upvotes: 3

Views: 4569

Answers (2)

FelipeAls
FelipeAls

Reputation: 22171

Cells in the same row are always of same height, the height of the tallest one.

  • Do nothing and it's fine
  • If you want cell widths to adapt somewhat so that cells with a lot of content are wider than others and less tall, then remove table-layout: fixed from parent table (by default it's not there)
  • min-height won't work in tables, you'll have to use height property here
  • you can adjust padding (internal margins) for better styling: th, td { padding: 4px 6px; }. Margins won't have any effect on cells (if cells aren't collapsed with border-collapse, then you can use border-spacing ... or padding) but table is still affected by margin as a whole of course

Upvotes: 2

greener
greener

Reputation: 5069

You can use CSS:

td { height: 100px }

A table cell will expand if there's more content.

Upvotes: 3

Related Questions