📜  rem vs em - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:58.408000             🧑  作者: Mango

代码示例2
/* 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.