body{
font-size: 62.5%;
}
And secondly, this technique would cause that when I wanted to by the font size in 'EM' I would only do ex: 20px = 2em; 15px = 1.5em; but it did not work: /
body{
font-size: 62.5%;
}
And secondly, this technique would cause that when I wanted to by the font size in 'EM' I would only do ex: 20px = 2em; 15px = 1.5em; but it did not work: /
What you are looking for is called Viewport Percentage Units which are units relative to screen size:
See example on JSFiddle
In JSFiddle, manipulate the width of the preview window to see the text to shrink / increase.
p{
font-size: 16px; font-size: 4vw;
}
Essentially, the values are:
1 v == 1% of the initial text size on the screen:
vw
(viewport width); vh
(viewport height); vmin
(the smallest of vw
or vh
); vmax
(the greater of vw
or vh
). You can read more about this at:
CSS Values and Units Module Level 3: 5.1.2 Viewport-percentage lengths .
Response Credits for the @jbenjohnson user in SOEN in this answer .
Something that I think might help you is the understanding of the REMs, which is a very interesting stop.
Although it is an English text, it is completely valid to read this link: link