@Bamo-D-Abdallah
Posted
rem
is good when you want your property size to increase or decrease based on the root element <html>
, so things like font-size
should definitely be in rem
, and in general if you are not sure what to use you can always fallback to rem
as it is more predictable than em
and other units.
Use em
when you want your element to increase or decrease based on its own font-size
property, so when you have an element that you want its margin
to increase when you increase the font-size
to make sure the content is still readable you can use em
on the margin
, or when you use letter-spacing
and word-spacing
you want the space to increase when the font-size
is also increased, that way when you increase the size of the font everything around it will adjust themselves based on the font-size
to preserve the original design.
Never use px
, I can't think of an example that you would ever need px
, even for @media (min-width)
use either rem
or em
(doesn't matter which one you use).
Marked as helpful
@AReactDeveloper
Posted
@Bamo-D-Abdallah very helpful tips thank you so much also our names are smillar ur is Abdallah im Abdelhak nice to meet you thank you for the very much needed explanation