SDS SDS - 11 months ago 52
CSS Question

Get rid of space between text and td's border

I have a

that has
and the text contained in the td has

How do I get rid of the space between the text and the border in a

Please find sample code here

Answer Source

While you can do this, you shouldn't. The reason there's extra space between the the lower edge of the word and the bottom border is that's where the lower parts, the descender of the y, g, etc, goes: (in this demo I've set line-height to 1 (no unit), which places the bottom edge of the y against the lower border.

Adjusting the line-height to 0.65 places the lower edge of the word test against the bottom border, but it's a fairly arbitrary measurement, and dependent upon the font-size used, and, probably, the particular browser.

And if you add overflow: hidden you can also hide the descending portion of the y if you wish: