Lower the height of a tables rows using CSS


I cannot seem to change the height of a tables rows using CSS.

AS A EXAMPLE: Say you wanted the height of the rows in a HTML table to be 5px high - how can it be done?


The size of table cells are by default defined by their content. You can reduce the top and bottom padding to reduce the height. I have not tried setting a fixed height in tables, but imagine you would have to deal with overflow.

HTML table rows do not accept many properties. height they do not accept. The height of an HTML table row is determined by the contents/height of the tallest table cell in that row. As @SamA74 said, you could pad the table cells. You could also assign a height to the cells, which would be treated as a minimum height. Table cells do not accept the overflow property.

I did try it out, and it was having none of it. So the height is determined by the size of the content, including any padding.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.