How to measure pixels | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to measure pixels

i have been having trouble placing contents on my pages because of not knowing how exactly the "pixel" measurement works. for example i want my content to be half a page wide how do i know that may be 250px is the right amount or how many pixels are half the width or height of my page.

20th Mar 2017, 7:40 PM
James N Mwita
James N Mwita - avatar
6 Answers
+ 10
You can also use percentages like 50% or something like that
20th Mar 2017, 7:43 PM
C.E.
C.E. - avatar
+ 6
guys, you recognize that there are different display resolutions? also not everybody has their browser window maximized... plus there are browser with built-in sidebars. so every browser has a different width and height. if you really want to deal with pixels here, you'd have to calculate the correct value with the help of JavaScript. better use percentages. 😉
20th Mar 2017, 8:39 PM
Mario L.
Mario L. - avatar
+ 3
Something I do all the time... open internet browser, open dev console, edit the pixel value using up and down arrows (keyboard keys) and see when the value fit my expecting and report the value in my CSS :3
20th Mar 2017, 8:32 PM
Geoffrey L
Geoffrey L - avatar
+ 2
At first choose a random measurement of pixels for height and width.Then increase/decrease the pixel measurement for height if you want to increase/decrease the height...or increase/decrease the pixel measurement for width if you want to increase/decrease the width
20th Mar 2017, 8:15 PM
Supratik Rakshit
Supratik Rakshit - avatar
+ 1
so it's more of a trial and error. thank you all.
21st Mar 2017, 4:54 AM
James N Mwita
James N Mwita - avatar
+ 1
Actually Mario is right you will have to target responsive but to keep it simple at first, do it with fixed value, then try to mix % and fixed and then try to understand responsive philosophy. Do it step by step I think.
21st Mar 2017, 5:51 AM
Geoffrey L
Geoffrey L - avatar