+ 1

What is the difference between % and px?

13th Oct 2017, 11:50 AM
Ayman Khan
Ayman Khan - avatar
3 Answers
+ 3
The percentage value is relative to your screen size a div with a 100% width would take the whole width of the screen regardless of the dimensions it is displayed on. (this is one way to achieve responsiveness) a pixel value is specific and won't change if you change the display screen
13th Oct 2017, 12:02 PM
CHMD
CHMD - avatar
+ 2
px is a unit of measurement for graphical objects and remains constant. however, % isn't and will change depending on screen height and width. %is flexible while pixel is fixed. If you develop a page only for phone, you will use px but for tablet, hand-held and pc you will use % that's where fixed and flexible CSS templates come into play.
13th Oct 2017, 5:15 PM
Core i9
Core i9 - avatar