+ 1
How does px work? does it go off original image size? What is equivalent of 100% in px?
2 ответов
+ 3
Hello, Anna Morra !
The pixel px is the most basic, absolute and final unit of measurement.
The number of pixels is set in the screen resolution settings, one px is just one such pixel on the screen. The browser will calculate all the values in pixels.
Pixels can be fractional, for example, the size can be set to 16.5px. This is perfectly normal, the browser itself uses fractional pixels for internal calculations. For example, there is an element with a width of 100px, it must be divided into three parts - 33.333 ... px appear willy-nilly. At the final display, the fractional pixels are, of course, rounded and become intact.
There are also "derivatives" of the pixel unit of measure: mm, cm, pt and pc, but they have long gone to the dustbin of history.
Here, if interested, their meanings:
1mm (mm) = 3.8px
1cm (cm) = 38px
1pt (typographical point) = 4/3 px
1pc (typographical peak) = 16px
Since the browser recounts these values in pixels, there is no point in using them.
0
Thank you, Alexander! So, what would be your recommendation to use to define img size? Would you go for %?