what is difference bt PX and % | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is difference bt PX and %

14th Jul 2016, 7:04 PM
sitanshu tripathi
sitanshu tripathi - avatar
4 Answers
+ 8
Pixels are fixed-size units that are used in screen media. One pixel is equal to one dot on the computer screen The percent unit is much like the “em” unit i.e telativr to your current size weight or value Take for example in< hr/> hr width=50% means 50% of the screen while hr width=50px is exactily 50dots on your screen
16th Jul 2016, 7:19 PM
Eragon Dragoneel
Eragon Dragoneel - avatar
+ 5
no % is some percent of screen like if width = t% then t=% of the total width will be occupied while 5 px is measured in pixels ,which vary from device to device a tablet can have more pixel than pc
15th Jul 2016, 7:07 AM
manish rawat
manish rawat - avatar
+ 2
Pixel (px) and percentage (%) are two different things. Pixel is a type of measurement while percentage we can say that is ratio of some measurement. Let's take a look for the explanation below. Let's say we have a screen of 2000 pixels width and 1000 pixels height. We need to display a line with left alignment. The example is width=50px and width=50%. 1. width=50px will make the line appear very short of the left side of screen because the total width is 2000 pixels. 2. width=50% will make the line appear from the most left side until the center of screen. It is because 50% is a half. Hope this can help you.
15th Jul 2016, 7:49 AM
Azwan Abdullah
Azwan Abdullah - avatar
+ 1
px is for the pixels i.e,30px,50px,80px.It depends upon your screen resulation while % is the n% part of your screen to be infected .
6th Aug 2016, 6:12 AM
LEO 12C Spider
LEO 12C Spider - avatar