Answers for "rem em vs px in css"

CSS
2

rem vs em

/* rem */
Translation of rem units to pixel value is determined by the font size
of the html element. This font size is influenced by inheritance from 
the browser font size setting unless explicitly overridden with a unit 
not subject to inheritance (px or vw). 

/* em */
Translation of em units to pixel values is determined by the font size 
of the element they’re used on. This font size is influenced by 
inheritance from parent elements unless explicitly overridden with 
a unit not subject to inheritance. ---> change the menu’s font size the
spacing (paddings etc) around the menu items will scale proportionately,
independently of the rest of the layout.
Posted by: Guest on February-09-2021

Browse Popular Code Answers by Language