Answer the question
In order to leave comments, you need to log in
Is it possible to use rem (root em) units in general for everything in CSS?
Greetings.
I read a lot on the net about rem units, but I don’t seem to fully understand it. They write that basically rem is used for:
- font-size
- line-height
- padding and margin of text blocks and only for them, at least that's what they advise. Nothing is really written in the W3C specification, two lousy lines.
Is it possible to use rem to indent blocks from each other, or is it better to use units like PX or % or rem STRICTLY for text and its accompanying padding and margins for outer margins? EM don't even want to use, one headache from them with their inheritance. Older browsers don't really bother, so rem was chosen.
For example, set the html tag to a font size of one pixel and use rem - is it possible or not necessary and why?
Could you explain in detail how, why, when, etc. to use rem?
Answer the question
In order to leave comments, you need to log in
Is it possible to use rem to indent a block from each other
I do it like this:
html, body {
font-size: 62.5%; // 1rem = 10px и никакой попаболи как с EM
}
html, body {
@media (min-width: 1600px) {
font-size: 78.125%;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question