offline version v3


174 of 298 menu

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 em unit
    that specifies a size in em
  • the rem unit
    that specifies a size in rem
  • the fr unit
    that specifies a size in fr
  • the % unit
    that specifies a size in percentage
  • the vw unit
    that specifies a size in vw
  • the vh unit
    that specifies a size in vh
  • the vmax unit
    that specifies a size in vmax
  • the vmin unit
    that specifies a size in vmin
enru