R
R
rtfm mftr2016-03-09 12:59:07
css
rtfm mftr, 2016-03-09 12:59:07

How to remove mysterious indents from h1...h6?

Even after the reset, the headers still have unwanted white spaces at the top and bottom. The larger the font size, the better it is visible. They belong exactly to the header, you can make sure in the inspector. Example
Codepen
Requires that the topmost point of the highest letter touches the parent block.
Adding line-height: 0.7em to h1 helps to get rid of them approximately, but
1. a few pixels still remain. you can continue to pick it up with your hands, but...
2. the solution is opaque
3. potential problems with different families, sizes, font units
4. it's hard to get into pixel perfect
Actually, where did they come from and how to overcome them. Possibly with operations in sass

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrey B., 2016-03-09
@rtfmmftr

There is no solution and there won't be, that's how font rendering works.
Adjust the line-height once and don't worry, you won't get PP here

K
keslo, 2016-03-09
@keslo

Can line-height play around?

E
Erling, 2016-03-18
@Erling

They have margin by default, except for line-height which creates padding.
Set margin:0; And then adjust as needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question