The px unit is a relative unit that represents pixels on the screen. It does not scale with user settings like font size but can be affected by screen resolution and zoom. The others (em, rem, vw) are relative units.
p { font-size: ?; }The pt unit stands for points, an absolute unit commonly used in print. The syntax requires the number followed immediately by the unit without spaces.
div on a screen with 96 DPI (dots per inch)?div { width: 2in; border: 1px solid black; }CSS defines 1 inch as 96 pixels. So 2 inches equals 192 pixels wide. The border adds 1 pixel around but does not change the width property.
@media (min-width: ?) { body { background: lightblue; } }
The cm unit is an absolute unit representing centimeters. Using min-width: 8cm targets devices with viewport width at least 8 centimeters wide.
px for font sizes cause accessibility issues for some users?Using absolute units like px fixes text size and does not respect user zoom or font size preferences, which can make reading difficult for users who need larger text.