- Use
rem
units forfont-size
andline-height
.- The user preferences are respected.
- We can change the apparent
px
value ofrem
to whatever we'd like.
- Use
px
,%
orvw
for layout purposes.- For example, when using
margin
,padding
,width
,height
, etc. - Easier to implement design requirements.
- Why not
rem
here as well?- Layout can break when changing the base browser font-size.
- If users go through the trouble of changing the browser Font Size (instead of the Zoom feature), they usually expect only the font size to change.
- Rare cases:
- If an element box directly depends on the text inside it (only when the font size is fluid based on screen size), use
em
for layout (notrem
).
- If an element box directly depends on the text inside it (only when the font size is fluid based on screen size), use
- For example, when using
Created
December 10, 2020 10:11
-
-
Save alexilyaev/ebd052c601851e8b89cee56853a19c41 to your computer and use it in GitHub Desktop.
CSS Styling Guidelines
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment