What are the units in Web development?
Pixel (px)
Depending on the resolution of the monitor to determine the length, the unit is used more in Web applications.
Points (PT)
Determines the length based on the font size defined by the Windows system.
Inches (in), centimeters (cm), and millimeters (mm)
Depending on the actual size of the display, the length is determined, and such units do not change with the display resolution.
12pt Word (PC)
That is, the Windows system-defined 12 font size is in units (1pc=12pt).
The number entered before the unit represents a multiple of the font size, such as {font-size:2pc;} Indicates that the text size is 24pt.
The above units are fixed values, changing the browser text size does not change the text of these units to be applied.
Font height (EM)
Represents the size of the current text.
{font-size:2em} refers to twice times the original text size.
Height of font x (ex)
Represents the height of the current letter "X".
%
is the size defined as a percentage of the current text.
{font-size:200%} refers to twice times the original text size.
What is the difference between PX and EM, and what is the specific case to use?
PX is suitable for non-responsive layouts, that is, the size is fixed, even if the browser is reduced, and the EM equivalent of multiple relationships, suitable for responsive layout, that is, the page will be the size of the browser to change the layout, such as the font will become larger or smaller.
Units in web development to solve problems