px unit
The absolute unit of measurement px
represents a cell on the matrix of an
electronic device. For example, if the
width of a smartphone screen is 480px,
this means that there are 480 cells
on the screen, each of which is equal
to 1px.
Example
Let's give the rectangle a width of
200px and a height of
100px:
<div>
</div>
div {
border: 1px solid black;
width: 200px;
height: 100px;
}
:
Example
Let's give the paragraph text a
font of 30 pixels:
<p>
text
</p>
p {
font-size: 30px;
}
:
See also
-
the
emunit
that specifies a size in em -
the
remunit
that specifies a size in rem -
the
frunit
that specifies a size in fr -
the
%unit
that specifies a size in percentage -
the
vwunit
that specifies a size in vw -
the
vhunit
that specifies a size in vh -
the
vmaxunit
that specifies a size in vmax -
the
vminunit
that specifies a size in vmin