Use rem
for Global Sizing; Use em
for Local Sizing
After setting the base font size at the root (html { font-size: 100%; }
), set the font size for textual elements to em
:
h2 {
font-size: 2em;
}
p {
font-size: 1em;
}
Then set the font-size for modules to rem
:
article {
font-size: 1.25rem;
}
aside .module {
font-size: .9rem;
}
Now each module becomes compartmentalized and easier to style, more maintainable, and flexible.
当前内容版权归 AllThingsSmitty 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 AllThingsSmitty .