<ratio>
Quick Summary for <ratio>
The
<ratio>
CSS data type, used for describing aspect ratios in media queries, denotes the proportion between two unitless values.
Code Usage for <ratio>
@media screen and (min-aspect-ratio: 16/9) { ... }
More Details for <ratio>
<ratio>
The <ratio>
CSS data type, used for describing aspect ratios in media queries, denotes the proportion between two unitless values.
Syntax
In Media Queries Level 3, the <ratio>
data type consisted of a strictly positive <integer>
followed by a forward slash ('/', Unicode U+002F SOLIDUS
) and a second strictly positive <integer>
. Spaces before and after the slash are optional. The first number represents the width, while the second represents the height.
In Media Queries Level 4, the <ratio> date type is updated to consist of a strictly positive <number>
followed by a forward slash ('/', Unicode U+002F SOLIDUS
) and a second strictly positive <number>
. In addition a single <number>
as a value is allowable.
Examples
Use in a media query
@media screen and (min-aspect-ratio: 16/9) { ... }
Common aspect ratios
Ratio | Usage | |
---|---|---|
4/3 | Traditional TV format in the twentieth century. | |
16/9 | Modern "widescreen" TV format. | |
185/100 = 91/50 | The most common movie format since the 1960s. | |
239/100 | "Widescreen," anamorphic movie format. |
Specifications
Specification |
---|
Media Queries Level 4 # values |
See also
aspect-ratio
media feature Select your preferred language English (US)DeutschFranç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