Last active
May 11, 2019 19:36
-
-
Save AvgustPol/42fcf6c9ca6d74936867d43fb8532256 to your computer and use it in GitHub Desktop.
[CSS] learning em
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[RU:] 1em всегда равен размеру шрифта данного блока | |
[EN:] 1em is always equal to the font size of this block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------- | |
[RU:] | |
------------------------------------- | |
Если в блоке указан размер font-size, то он "надписывает" значение заданого ранее font-size. Пример: | |
body { | |
font-size: 16px; | |
} | |
.foo { | |
font-size: 2em; // 2em = 16px * 2 = 32px | |
margin: 0 0 .5em; // .5em = тут будет 16, потому что как font-size берется 32px, с 11й линии. | |
} | |
------------------------------------- | |
[EN:] | |
------------------------------------- | |
If the font-size is specified in the block, it "overrides" the value of the previously specified font-size. Example: | |
body { | |
font-size: 16px; | |
} | |
.foo { | |
font-size: 2em; // 2em = 16px * 2 = 32px | |
margin: 0 0 .5em; // .5em = here 0.5em equals to 16px, because 32px is taken as font-size, from the 25th line. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment