CSS unit rem
CSS unit rem
The CSS unit rem
can be used to set the font size of HTML elements relative to the font size of the root element. 1 rem
represents the size of the base font within the root element - the <html>
tag.
In the example code block, the font size for all the <span>
elements will be twice the size of the font size declared for the root element.
html {
font-size: 18px;
}
span {
font-size: 2rem;
}
Join the conversation