--- title: '@viewport' slug: Web/CSS/@viewport tags: - Adaptation - At-rule - CSS - Device - NeedsContent - NeedsTranslation - Reference - TopicStub translation_of: Web/CSS/@viewport ---
{{CSSRef}}
The @viewport
CSS at-rule contains a set of nested descriptors in a CSS block that is delimited by curly braces. These descriptors control viewport settings, primarily on mobile devices.
A zoom factor of 1.0
or 100%
corresponds to no zooming. Larger values zoom in. Smaller values zoom out.
Browsers are supposed to ignore unrecognized descriptors.
min-width
max-width
width
min-width
and max-width
min-height
max-height
height
min-height
and max-height
zoom
min-zoom
max-zoom
user-zoom
orientation
@viewport { min-width: 640px; max-width: 800px; } @viewport { zoom: 0.75; min-zoom: 0.5; max-zoom: 0.9; } @viewport { orientation: landscape; }
Specification | Status | Comment |
---|---|---|
{{SpecName('CSS3 Device', '#the-atviewport-rule', '@viewport')}} | {{Spec2('CSS3 Device')}} | Initial definition |
<meta name="viewport">