<dimension>
Quick Summary for <dimension>
Code Usage for <dimension>
12px 12 pixels 1rem 1 rem 1.2pt 1.2 points 2200ms 2200 milliseconds 5s 5 seconds 200hz 200 Hertz 200Hz 200 Hertz (values are case insensitive)
More Details for <dimension>
<dimension>
The <dimension>
CSS data type represents a <number>
with a unit attached to it, for example 10px
.
CSS uses dimensions to specify distances (<length>
), durations (<time>
), frequencies (<frequency>
), resolutions (<resolution>
), and other quantities.
Syntax
The syntax of <dimension>
is a <number>
immediately followed by a unit which is an identifier. Unit identifiers are case insensitive.
Examples
Valid dimensions
12px 12 pixels 1rem 1 rem 1.2pt 1.2 points 2200ms 2200 milliseconds 5s 5 seconds 200hz 200 Hertz 200Hz 200 Hertz (values are case insensitive)
Invalid dimensions
12 px The unit must come immediately after the number. 12"px" Units are identifiers and therefore unquoted. 3sec The seconds unit is abbreviated "s" not "sec".
Specifications
Specification |
---|
CSS Values and Units Module Level 5 # dimensions |
See also
CSS data types Learn to style HTML using CSS CSS distances (<length>
), durations (<time>
), frequencies (<frequency>
), and resolutions (<resolution>
) Last modified: Aug 12, 2021, by MDN contributors
Select your preferred language English (US)Français日本語中文 (简体) Change language Posted in
12:22 am, February 22, 2022
Add Comment
Other Items in CSS
rgb()
rgba()
:right
right
@right-bottom
:root
rotate
rotate()
rotate3d()
rotateX()
rotateY()
rotateZ()
row-gap
ruby-align
ruby-position
saturate()
scale
scale()
scale3d()
scaleX()
scaleY()
scaleZ()
:scope
scroll-behavior
scroll-margin
scroll-margin-block
scroll-margin-block-end
scroll-margin-block-start
scroll-margin-bottom
scroll-margin-inline
scroll-margin-inline-end
scroll-margin-inline-start
scroll-margin-left
scroll-margin-right
scroll-margin-top
scroll-padding
scroll-padding-block
scroll-padding-block-end
scroll-padding-block-start
scroll-padding-bottom
scroll-padding-inline
scroll-padding-inline-end
scroll-padding-inline-start
scroll-padding-left
scroll-padding-right
scroll-padding-top
scroll-snap-align
scroll-snap-stop
scroll-snap-type
@scroll-timeline