HTML / CSS: removing spaces between elements - 0.1px font size advantage (instead of 0)?

CSS typically removes spaces between elements by setting the font size of the container element to 0px.

The child elements are again set to normal size.

I always applied "font-size: 0" to the container element and worked fine.

Now I saw in the code of other people that many use "font-size: 0.1px;" instead. For example here: https://www.barrelny.com/blog/text-align-justify-and-rwd/

In the Break Elements section ...

What is the advantage of keeping the remaining font sizes?

+5
source share
1 answer

Here is a list of some solutions for your promlem: https://css-tricks.com/fighting-the-space-between-inline-block-elements/

In my opinion, using font-size : 0 / 0.1px might not be the best way:

Matt Stow reports that the font size is: 0; the tech has some problems on Android. Quote: Pre-Jellybean does not take up space at all, and Jellybean has an error due to which the last element randomly has a small bit of space. See Research.

Also note: if you define fonts in ems, this size of zero font size can be a problem, since the cascade of ems in children will also have a font size of zero. Rem would be useful here, otherwise any other non-cascading font size to raise it.

Another oddity! Doug Stewart showed me that if you use @ font-face with this technique, fonts will lose antialiasing in Safari 5.0.x. (test case) (screenshot).

+1
source

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


All Articles