Pt px em rem, ptpx
Px
In the initial production of the Web page, we used "px" to set our text, because it is relatively stable and accurate. However, this method has a problem. When a user browses the Web page we created in the browser, the font size of the browser is changed, and the layout of the Web page is broken. This is a big problem for users who care about their website availability. Therefore, we propose to use "em" to define the web page font.
Em
As mentioned above, it is convenient and consistent to use "px", but there will be a problem when you zoom in or zoom in the browser to browse the page. To solve this problem, we can use the "em" unit.
!!!Em is calculated relative to the attributes of the parent element.If you want to calculate the conversion between px and em
RemEM is used to set the font size relative to its parent element. In this case, a problem occurs. You may need to know the size of its parent element for any element settings.
And Rem is relative to the root element This means that we only need to determine a reference value in the root element.
A px to em URL:
PX to EM