Gap problem when display: block is used for “th” and “td” in table and its solution

When a table element (th or td) is set to display: block with CSS, unintended gaps may occur. The cause may be that you have specified em for the input padding within the element. em is a unit relative to the current font size, and the resulting decimal point calculation may cause an error that appears as a gap in some browsers.

This problem can be solved by specifying px (pixels) for the padding. px is an absolute unit and is less likely to be interpreted differently by different browsers.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top