Which unit should I use for HTML?

I like to use em, and I try to stay away from%, because it tends to easily scoop up the design, and pt, px, cm ... Because they are not so friendly to all devices. Am I doing it right?

+4
source share
3 answers

There are reasons why css offers you a choice. So this is not a question of right or wrong. But if you are looking for a way to make your site more accessible to facilitate the creation of fonts and elements, then you are on the right track. Go with em.

+3
source

It depends. Using the sizes of the links to the font size and using the% links to the size of the container (and, ultimately, on the screen). In some places, one will be better than the other to achieve a consistent effect. I agree that it is generally useful to avoid absolute units, but px is useful for small sizes (e.g. border widths, spacers).

+2
source

Yes. It is scalable, easy to remember, and even easy to convert to other dimensions for comparison :)

+1
source

Source: https://habr.com/ru/post/1332755/


All Articles