PX PX pixels are relative to the screen resolution of the display.You can't adjust the size of font, button and so on when using browser to zoom in page.The value of
em is not fixed, it inherits the font size of the parent element and represents the multiple.If the parent size is not set at the current parent level, it is relative to the default font size of the browser.The value of
rem is not fixed, it is always based on the root element <html>, and also represents the multiple.
em introduces the use of
em relative to its parent font size, that is, multiples.The default font size of the browser is 16px.