Difference between px & % in CSS3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Difference between px & % in CSS3

When we use 10px & 10% them it will display different output. How px & % actually work? Elaborate it with example.

19th Jul 2020, 12:10 PM
TheDK
TheDK - avatar
1 Answer
+ 2
px is a “fixed” unit of measure - it’s unit size is based on the actual number of pixels on device screen and will always occupy that many pixels regardless of its parent tag’s size. % is known as “relative” units - it auto-resize according to his “parent tag’s” unit size. https://www.quora.com/What-are-the-differences-between-px-em-and-in-CSS-Which-one-should-I-use-and-why
19th Jul 2020, 12:17 PM
Mantafounis Panagiotis
Mantafounis Panagiotis - avatar