Is pixel the same thing as % | Sololearn: Learn to code for FREE!


Is pixel the same thing as %

8/25/2018 1:36:09 PM

Muhammed Sodiq Akande

13 Answers

New Answer


An object styled using px is fixed according to the size of pixels on a device. An object styled using % is relative to its container/max dimensions, and will adjust to fit different containers. An object of height 50px is just what it is. An object of height 50% would span half its container.


Nope they are different



I assume you know that our screens are made of pixels. Assume you have a screen of length 1000 pixel. Now an element with 50% length would cover half the screen and an element with 50 px length will cover only 1/20th (5%) of the screen.


No...pixels are defined according to resolution of the device but % is used relative to the block you are storing the object


no, % means percentage of maximum width lets make an example <div style="width:100px;"> <div style="width:50%;"> </div> </div> the first div will be 100 pixels in width the second one will be 50 pixels, because: >the maximum width in % is inherited and is 100 pixels >we took 50% of the maximum width, so it will be 50 pixels


no bro.pixel is different and % is pixels we can give how much pixels we divide in this the display will divided into two part one part will divided into 50 pixels.and another part will divided into remaining pixels.for % this the program will first convert % into pixels.then it will divide the this the display will divided into half screen .because 50% means it will divide into half screen one side and another half into another side


Pixels are an absolute length. 1 pixel is equal to 1/96 of an inch . Percentages are relative to another value. 1% is 1/100 of another length. Pixels is a fixed value. For example, the header on this site is fixed to 980px. Percentage, well, it is a part of a parent measure where the browser is the outermost parent. Pixel value is fixed however percent value may varry according to your screen resolutions.


nope.. pixel is the fix thing it can be vary with screen size bt % very with screen size if width is set to 50% then in desktop of 1024px its with 512px and in mobile of 320px resolution gets 160px


Pixels (px) : Pixels are fixed-size units that are used in screen media (i.e. to be read on the computer screen). One pixel is equal to one dot on the computer screen (the smallest division of your screen’s resolution). Many web designers use pixel units in web documents in order to produce a pixel-perfect representation of their site as it is rendered in the browser. One problem with the pixel unit is that it does not scale upward for visually-impaired readers or downward to fit mobile devices. Percent (%) : The percent unit is much like the “em” unit, save for a few fundamental differences. First and foremost, the current font-size is equal to 100% (i.e. 12pt = 100%). While using the percent unit, your text remains fully scalable for mobile devices and for accessibility.



yes my friend they are same. it's up to you what do you choose b/w px and %


yes no problem