Q&A
Ask and answer questions to make information more available to wider audiences.
Mya Linwod @linwodmya   23, Apr 2023 12:00 AM
units in the CSS
How do you specify units in the CSS?
answers 1
 
Answer 1
David Brasco @davidbrasco89   28, Apr 2023 11:08 AM
There are mainly four different units in the CSS that are px, em, pt, and percentage (%).
Px (Pixel) is used for fine-grained control and alignment and not cascade. To get it sharp, we can use 1px or multiple of px.
Em is used to maintain relative size and responsive fonts. 1em = 16px having also the same font size. It is advisable to set the font size to 10px in common practice.
Pt (point) is a fixed-size unit that is used in print. 1pt = 1/72 inch.
Percentage (%) is used to set the font size with respect to the font size of the body. Thus, it is necessary to set the reasonable font size of the body.