This specification provides a way for an author to specify, in CSS, the size, zoom factor, and orientation of the viewport that is used as the base for the initial containing block.
This section is not normative.
CSS 2.1 [[!CSS21]] specifies an initial containing block for continuous media that has the dimensions of the viewport. Mobile/handheld device browsers have a viewport that is generally a lot narrower than a desktop browser window at a zoom level that gives a CSS pixel size recommended by CSS 2.1.
The narrow viewport is a problem for documents designed to look good in desktop browsers. The result is that mobile browser vendors use a fixed initial containing block size that is different from the viewport size, and close to that of a typical desktop browser window. In addition to scrolling or panning, zooming is often used to change between an overview of the document and zoom in on particular areas of the document to read and interact with.
Certain DOCTYPEs (for instance XHTML Mobile Profile) are used to recognize mobile documents which are assumed to be designed for handheld devices, hence using the viewport size as the initial containing block size.
Additionally, an HTML META tag has been introduced for allowing an
author to specify the size of the initial containing block, and the initial
zoom factor directly. It was first implemented by Apple for the Safari/iPhone
browser, but has since been implemented for the Opera, Android, and Fennec
browsers. These implementations are not fully interoperable and this
specification is an attempt at standardizing the functionality provided by
the viewport META tag in CSS.
This specification follows the CSS property definition conventions from [[!CSS3SYN]].
Value types are defined in [[!CSS3VAL]].
In CSS 2.1 a viewport is a feature of a user agent for continuous media and used to establish the initial containing block for continuous media. For paged media, the initial containing block is based on the page area. The page area can be set through @page rules. Hence, @viewport applies to continuous media, and @page to paged media, and they will not interact or conflict.
This specification introduces a way of overriding the size of the viewport provided by the user agent (UA). Because of this, we need to introduce the difference between the initial viewport and the actual viewport.
When the actual viewport cannot fit inside the window or viewing area, either because the actual viewport is larger than the initial viewport or the zoom factor causes only parts of the actual viewport to be visible, the UA should offer a scrolling or panning mechanism.
It is recommended that initially the upper-left corners of the
actual viewport and the window or viewing area are aligned if the
base direction of the document is ltr. Similarly, that the upper-right
corners are aligned when the base direction is rtl. The base direction for
a document is defined as the computed value of the
direction property for the first
BODY element of an HTML or XHTML document. For
other document types, it is the computed
direction for the root element.
"dbaron: The question is, what does this do on the desktop browser? (And what's a desktop browser)". Need to say that a "desktop" browser typically have no UA styles, as opposed to the UA stylesheet outlined for current mobile behaviour, and that no UA styles for @viewport will give "desktop" behaviour per default (actual viewport is initial viewport).
@viewport ruleThe @viewport at-rule
consists of the @-keyword followed by a block of descriptors
describing the viewport.
The descriptors inside an @viewport
rule are per document and there is no inheritance involved. Hence
declarations using the ‘inherit’
keyword will be dropped. They work similarly to @page
descriptors and follow the cascading order of CSS. Hence, descriptors in
@viewport rules will override descriptors from
preceding rules. The declarations allow !important which will affect
cascading of descriptors accordingly.
Should the @viewport rule apply to top-level documents only? If not, we need to say something about different zoom factors in frames.
Bert: What's interactions of @viewport and @page
This example sets the viewport to fit the width of the device. Note that it is enough to set the width as the height will be resolved from the width.
@viewport {
width: device-width;
}
The syntax for the @viewport rule is as follows
(using the notation from the Grammar appendix of CSS
2.1 [[!CSS21]]):
viewport
: VIEWPORT_SYM S*
'{' S* declaration? [ ';' S* declaration? ]* '}' S*;
with the new token:
@{V}{I}{E}{W}{P}{O}{R}{T} {return VIEWPORT_SYM;}
where:
V v|\\0{0,4}(56|76)(\r\n|[ \t\r\n\f])?|\\v
W w|\\0{0,4}(57|77)(\r\n|[ \t\r\n\f])?|\\w
The viewport non-terminal is added to the stylesheet
production along with the ruleset, media, and
page non-terminals:
stylesheet
: [ CHARSET_SYM STRING ';' ]?
[S|CDO|CDC]* [ import [ CDO S* | CDC S* ]* ]*
[ [ ruleset | media | page | viewport ] [ CDO S* | CDC S* ]* ]*
;
It is also added to media production to allow
@viewport rules nested inside
@media rules This is extending
the CSS 2.1 syntax. A draft of CSS3 Paged Media also allows page inside
@media.:
media : MEDIA_SYM S* media_list LBRACE S* [ ruleset | viewport ]* '}' S* ;
This section presents the descriptors that are allowed inside an
@viewport rule. Other descriptors than those
listed here will be dropped.
Relative length values are resolved against initial values. For instance
'em's are resolved against the initial value of the
font-size property. Viewport lengths (vw,
vh, vmin, vmax) are relative to the initial viewport.
min-width’ and
‘max-width’ descriptors| Name: | min-width |
| Value: | <viewport-length> |
| Initial: | auto |
| Percentages: | Refer to the width of the initial viewport |
| Media: | visual, continuous |
| Computed value: | ‘auto’,
‘device-width’,
‘device-height’, an
absolute length, or a percentage as specified |
| Name: | max-width |
| Value: | <viewport-length> |
| Initial: | auto |
| Percentages: | Refer to the width of the initial viewport |
| Media: | visual, continuous |
| Computed value: | ‘auto’,
‘device-width’,
‘device-height’, an
absolute length, or a percentage as specified |
Specifies the minimum and maximum width of the viewport that is used to set the size of the initial containing block where
<viewport-length> = auto | device-width | device-height | <length> | <percentage>
and the values have the following meanings:
auto’device-width’device-height’A positive absolute or relative length.
A percentage value relative to the width or height of the initial viewport at zoom factor 1.0, for horizontal and vertical lengths respectively. Must be positive.
The min-width and max-width descriptors are inputs to the constraining procedure. The width will initially be set as close as possible to the initial viewport width within the min/max constraints.
width’
shorthand descriptor| Name: | width |
| Value: | <viewport-length>{1,2} |
| Initial: | See individual descriptors |
| Percentages: | See individual descriptors |
| Media: | visual, continuous |
| Computed value: | See individual descriptors |
This is a shorthand descriptor for setting both min-width and max-width. One <viewport-length> value will set both min-width and max-width to that value. Two <viewport-length> values will set min-width to the first and max-width to the second.
min-height’ and
‘max-height’ descriptor| Name: | min-height |
| Value: | <viewport-length> |
| Initial: | auto |
| Percentages: | Refer to the height of the initial viewport |
| Media: | visual, continuous |
| Computed value: | ‘auto’,
‘device-width’,
‘device-height’, an
absolute length, or a percentage as specified |
| Name: | max-height |
| Value: | <viewport-length> |
| Initial: | auto |
| Percentages: | Refer to the height of the initial viewport |
| Media: | visual, continuous |
| Computed value: | ‘auto’,
‘device-width’,
‘device-height’, an
absolute length, or a percentage as specified |
Specifies the minimum and maximum height of the viewport that is used to set the size of the initial containing block.
The min-height and max-height descriptors are inputs to the constraining procedure. The height will initially be set as close as possible to the initial viewport height within the min/max constraints.
height’ shorthand descriptor| Name: | height |
| Value: | <viewport-length>{1,2} |
| Initial: | See individual descriptors |
| Percentages: | See individual descriptors |
| Media: | visual, continuous |
| Computed value: | See individual descriptors |
This is a shorthand descriptor for setting both min-height and max-height. One <viewport-length> value will set both min-height and max-height to that value. Two <viewport-length> values will set min-height to the first and max-height to the second.
zoom’ descriptor| Name: | zoom |
| Value: | auto | <number> | <percentage> |
| Initial: | auto |
| Percentages: | The zoom factor itself |
| Media: | visual, continuous |
| Computed value: | ‘auto’, or a positive
number or percentage as specified. |
Specifies the initial zoom factor for the window or viewing area. This is a magnifying glass type of zoom. Interactively changing the zoom factor from the initial zoom factor does not affect the size of the initial or the actual viewport.
Values have the following meanings: Should both numbers and percentages be allowed?
auto’auto’ values
for ‘zoom’.A positive number used as a zoom factor. A factor of 1.0 means that no zooming is done. Values larger than 1.0 gives a zoomed-in effect and values smaller than 1.0 a zoomed-out effect.
A positive percentage value used as a zoom factor. A factor of 100% means that no zooming is done. Values larger than 100% gives a zoomed-in effect and values smaller than 100% a zoomed-out effect.
min-zoom’ descriptor| Name: | min-zoom |
| Value: | auto | <number> | <percentage> |
| Initial: | auto |
| Percentages: | The zoom factor itself |
| Media: | visual, continuous |
| Computed value: | ‘auto’, or a positive
number or percentage as specified. |
Specifies the smallest allowed zoom factor. It is used as input to the
constraining procedure to constrain
non-‘auto’
‘zoom’
values, but also to limit the allowed zoom factor that can be set through
user interaction. The UA should also use this value as a constraint when
choosing an actual zoom factor when the used value of
‘zoom’ is
‘auto’.
Values have the following meanings:
auto’zoom’ descriptor used in the
constraining procedureA positive number limiting the minimum value of the zoom factor.
A positive percentage limiting the minimum value of the zoom factor.
max-zoom’ descriptor| Name: | max-zoom |
| Value: | auto | <number> | <percentage> |
| Initial: | auto |
| Percentages: | The zoom factor itself |
| Media: | visual, continuous |
| Computed value: | ‘auto’, or a positive
number or percentage as specified. |
Specifies the largest allowed zoom factor. It is used as input to the
constraining procedure to constrain
non-‘auto’
‘zoom’
values, but also to limit the allowed zoom factor that can be set through
user interaction. The UA should also use this value as a constraint when
choosing an actual zoom factor when the used value of
‘zoom’ is
‘auto’.
Values have the following meanings:
auto’zoom’
descriptor used in the constraining
procedureA positive number limiting the maximum value of the zoom factor.
A positive percentage limiting the maximum value of the zoom factor.
user-zoom’ descriptor| Name: | user-zoom |
| Value: | zoom | fixed |
| Initial: | zoom |
| Percentages: | N/A |
| Media: | visual, continuous |
| Computed value: | ‘zoom’ or
‘fixed’ as specified. |
Specifies if the zoom factor can be changed by user interaction or not.
Values have the following meanings:
zoom’fixed’orientation’ descriptor| Name: | orientation |
| Value: | auto | portrait | landscape |
| Initial: | auto |
| Percentages: | N/A |
| Media: | visual, continuous |
| Computed value: | ‘auto’,
‘portrait’, or
‘landscape’ as specified. |
This descriptor is used to request that a document is displayed in portrait or landscape mode. For a UA/device where the orientation is changed upon tilting the device, an author can use this descriptor to inhibit the orientation change. The descriptor should be respected for standalone web applications, and when the document is displayed in fullscreen. It is recommended that it is ignored for normal web navigation to avoid confusing the user.
Values have the following meanings:
auto’portrait’landscape’For the procedure below:
Descriptors refer to the values resolved/constrained to at that point in the procedure. They are initially resolved to their computed values.
width and
height refer to the
resolved viewport size and not the shorthand descriptors. They are both
initially ‘auto’.
MIN/MAX computations where one of the arguments is
‘auto’ resolve to the other argument.
For instance, MIN(0.25, 'auto') = 0.25, and
MAX(5, 'auto') = 5.
initial-width is the
width of the initial viewport in pixels at zoom factor 1.0.
initial-height is the
height of the initial viewport in pixels at zoom factor 1.0.
The used values are resolved from the computed values going through the steps below.
User agents are expected, but not required, to re-run this procedure and re-layout the document, if necessary, in response to changes in the user environment, for example if the device is tilted from landscape to portrait mode or the window that forms the initial viewport is resized.
However, Media Queries and Device Adaption are tethered specifications. As a result, UAs that also support Media Queries must re-run this procedure and re-layout the document in all cases where changes in the user environment would cause them to re-evaluate Media Queries.
min-zoom
and max-zoom valuesmin-zoom is not
‘auto’ and
max-zoom is not
‘auto’,
set max-zoom = MAX(min-zoom, max-zoom)zoom
value to the [min-zoom, max-zoom] rangezoom is not
‘auto’,
set zoom = MAX(min-zoom, MIN(max-zoom, zoom))auto’ lengths to pixel lengthsdevice-width’,
‘device-height’) to pixel
values for the ‘min-width’,
‘max-width’,
‘min-height’ and
‘max-height’
descriptors.
width and
height from min/max descriptorsmin-width or
max-width is not
‘auto’, set
width = MAX(min-width, MIN(max-width, initial-width))min-height or
max-height is not
‘auto’, set
height = MAX(min-height, MIN(max-height, initial-height))width
valuewidth and
height are both
‘auto’, set width =
initial-widthwidth is
‘auto’, set width = height *
(initial-width / initial-height)height
valueheight is
‘auto’, set height = width *
(initial-height / initial-width)For several media features, the size of the initial containing block and
the orientation of the device affects the result of a media query
evaluation, which means that the effect of
@viewport rules on media queries needs extra
attention.
Bert: If you put @viewport, can you put @viewport in @media? Say what it means?
From the Media Queries specification [[!MEDIAQ]]:
“To avoid circular dependencies, it is never necessary to apply the style sheet in order to evaluate expressions. For example, the aspect ratio of a printed document may be influenced by a style sheet, but expressions involving ‘device-aspect-ratio’ will be based on the default aspect ratio of the user agent.”
For @viewport rules, though, it is recommended
that they are applied before media queries for other rules are evaluated.
Recommended procedure for applying CSS rules:
@viewport rules. If
@viewport rules rely on media queries, use
the viewport descriptors of the initial viewport.The rationale for using the viewport descriptors obtained from applying
the @viewport rules for evaluating media
queries for style rules, is that media queries should match the
actual viewport that the document will be
layed out in and not the initial or the one specified in the UA stylesheet.
Consider the example below given that the UA stylesheet has a viewport
width of 980px, but a device-width and initial
viewport width of 320px. The author has made separate styles to make
the document look good for initial containing block widths above or below
400px. The actual viewport used will be
320px wide, and in order to match the styles with the
actual viewport width, the viewport
resulting from applying the @viewport rules
should be used to evaluate the media queries.
Given a device-width of 320px and a UA stylesheet viewport width of 980px, the first media query will not match, but the second will.
@viewport {
width: device-width;
}
@media screen and (min-width: 400px) {
div { color: red; }
}
@media screen and (max-width: 400px) {
div { color: green; }
}
Another example:
The media query below should match because the
@viewport rule is applied before the media
query is evaluated.
@media screen and (width: 397px) {
div { color: green; }
}
@viewport {
width: 397px;
}
Below is an example where an @viewport rule
relies on a media query affected by the viewport descriptors.
The green color should be applied to a div because the
initial viewport
width is used to evaluate the media query for the second
@viewport rule, but the
actual viewport is
used for evaluating the media query when applying style rules.
@viewport {
width: 397px;
}
@media screen and (width: 397px) {
@viewport {
width: 500px;
}
}
@media screen and (width: 397px) {
div { color: green; }
}
It is recommended that authors do not write
@viewport rules that rely on media queries
whose evaluation is affected by viewport descriptors. Is is also
recommended that the @viewport rule(s) is
placed as early in the document as possible to avoid unnecessary
re-evaluation of media queries or reflows.
The next example illustrates possible circular dependencies between media
queries and @viewport rules. Assuming a UA
stylesheet viewport width larger than 200px, the first viewport rule would
apply causing an actual viewport width of
100px. If the media queries were based on the
actual viewport, a re-evaluation would
apply the second @viewport rule which would
in turn cause the first media query to be true, which means we're back to
start.
@media screen and (min-width: 200px) {
@viewport {
width: 100px;
}
}
@media screen and (max-width: 200px) {
@viewport {
width: 300px;
}
}
Properties in the CSSOM and CSSOM View specifications refer to the viewport and the initial containing block. If any of those properties should refer to the initial viewport and not the actual viewport, those exceptions need to be adressed.
The @viewport rule is exposed to the CSSOM
through a new CSSRule interface
The following rule type is added to the CSSRule
interface. It provides identification for the new viewport rule.
interface CSSRule {
...
const unsigned short VIEWPORT_RULE = 15;
...
};
The CSSViewportRule interface represents the style rule
for an @viewport rules
interface CSSViewportRule : CSSRule {
readonly attribute CSSStyleDeclaration style;
};
style of type CSSStyleDeclaration
@viewport rule.
Requirements for a conforming UA:
The ‘min-width’,
‘max-width’,
‘width’,
‘min-height’,
‘max-height’, and
‘height’ descriptors must be supported.
The ‘min-zoom’,
‘max-zoom’, and
‘zoom’ descriptors must be supported as
input to the
constraining procedure. However,
the UA may choose to use a different zoom factor when presenting the
document to the user, and use different minimum and maximum zoom
limits for the user interaction.
This will for instance allow UAs without zooming capabilities to conform and still have interoperable implementations when it comes to viewport dimensions. It will also allow the UA to choose a different zoom factor when content overflows the actual viewport.
Support for the ‘user-zoom’
and ‘orientation’
descriptors is optional.
META elementThis section is not normative.
This section describes a mapping from the content attribute of the
viewport META element, first implemented by Apple in the iPhone
Safari browser, to the descriptors of the
@viewport rule described in this
specification.
In order to match the Safari implementation, the following parsing algorithm and translation rules rely on the UA stylesheet below. See the section on UA stylesheets for an elaborate description.
@viewport {
width: extend-to-zoom 980px;
min-zoom: 0.25;
max-zoom: 5;
}
Note that these values might not fit well with all UAs. For instance, with a min-zoom of 0.25 you will be able to fit the whole width of the document inside the window for widths up to 1280px on a 320px wide device like the original iPhone, but only 960px if you have a 240px display (all widths being given in CSS pixel units).
The recognized properties in the viewport META element are:
widthheightinitial-scaleminimum-scalemaximum-scaleuser-scalableBelow is an algorithm for parsing
the content attribute of the META tag
produced from testing Safari on the iPhone. The testing was done on an iPod touch running iPhone OS 4.
The UA string of the browser: "Mozilla/5.0 (iPod; U; CPU
iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko)
Version/4.0.5 Mobile/8A293 Safari/6531.22.7". The pseudo
code notation used is based on the notation used in [Algorithms].
The whitespace class contains the following characters (ascii):
The recognized separator between property/value pairs is comma for the Safari implementation. Some implementations have supported both commas and semicolons. Because of that, existing content use semicolons instead of commas. Authors should be using comma in order to ensure content works as expected in all UAs, but implementors may add support for both to ensure interoperability for existing content.
The separator class contains the following characters (ascii), with comma as the preferred separator and semicolon as optional:
Parse-Content(S) i ← 1 while i ≤ length[S] do while i ≤ length[S] and S[i] in [whitespace, separator, '='] do i ← i + 1 if i ≤ length[S] then i ← Parse-Property(S, i) Parse-Property(S, i) start ← i while i ≤ length[S] and S[i] not in [whitespace, separator, '='] do i ← i + 1 if i > length[S] or S[i] in [separator] then return i property-name ← S[start .. (i - 1)] while i ≤ length[S] and S[i] not in [separator, '='] do i ← i + 1 if i > length[S] or S[i] in [separator] then return i while i ≤ length[S] and S[i] in [whitespace, '='] do i ← i + 1 if i > length[S] or S[i] in [separator] then return i start ← i while i ≤ length[S] and S[i] not in [whitespace, separator, '='] do i ← i + 1 property-value ← S[start .. (i - 1)] Set-Property(property-name, property-value) return i
Set-Property matches the
listed property names case-insensitively.
The property-value strings are interpreted
as follows:
property-value can be
converted to a number using strtod, the
value will be that number. The remainder of the string is
ignored.property-value string
will be matched with the following strings
case-insensitively: yes,
no, device-width,
device-heightextend-to-zoom’In order to be able to implement the functionality from
META viewport where the viewport width or height
is extended to fill the viewing area at a given zoom level, we introduce
a UA internal value to the list of <viewport-length>
values called ‘extend-to-zoom’
It will be used in width and height declarations in the translation
outlined in the section below.
This new value is necessary in order to implement the mapping for two
reasons. First, whether resolving the width/height needs to extend the
pixel length to the visible width/height for a given zoom factor depends
on the current initial width/height.
<meta name="viewport" content="width=400, initial-scale=1">
yields a width of 400px for an initial-width of 320px, and 640px for an
initial width of 640px. This can not be expressed as normative min/max
descriptors that would constrain correctly when the initial width changes
like for an orientation change.
Secondly, the extended width/height also relies on cascading viewport
properties from different sources, including
‘min-zoom’ and
‘max-zoom’ from the UA
stylesheet. For instance, if the UA stylesheet has
max-zoom: 5, and the initial width is 320px,
<meta name="viewport" content="width=10">
will resolve to 64px.
extend-to-zoom’The ‘extend-to-zoom’
value is resolved to pixel or auto lengths as part of
step 3 of the
constraining procedure. Since this
is a non-normative descriptor value, the resolution is described
here. Note that max-descriptors need to be resolved to pixel lengths
before min-descriptors when
‘extend-to-zoom’
is a valid value.
Let extend-zoom = MIN(zoom, max-zoom)
For non-‘auto’
extend-zoom, let:
extend-width = initial-width / extend-zoom extend-height = initial-height / extend-zoom
Then, resolve for
‘extend-to-zoom’
as follows:
extend-zoom is
‘auto’:
max-width is
‘extend-to-zoom’, set
max-width = 'auto'max-height is
‘extend-to-zoom’, set
max-height = 'auto'min-width is
‘extend-to-zoom’, set
min-width = max-widthmin-height is
‘extend-to-zoom’, set
min-height = max-heightextend-zoom is
non-‘auto’:
max-width is
‘extend-to-zoom’, set
max-width = extend-widthmax-height is
‘extend-to-zoom’, set
max-height = extend-heightmin-width is
‘extend-to-zoom’, set
min-width = MAX(extend-width, max-width)min-height is
‘extend-to-zoom’, set
min-height = MAX(extend-height, max-height)@viewport descriptorsThe Viewport META element is placed in the
cascade as if it was a STYLE element, in the
exact same place in the dom, that only contains a single
@viewport rule.
Each of the property/value pair from the parsing in the previous section are translated, and added to that single at-rule as follows:
Unknown properties are dropped.
width
and height
propertiesThe width and
height viewport
META properties are translated into
‘width’ and
‘height’ descriptors, setting
the ‘min’ value to
‘extend-to-zoom’ and the
‘max’ value to the pixel
length from the viewport META property.
[1px, 10000px]device-width
and device-height
are used as keywordsThis META element:
<meta name="viewport" content="width=500, height=600">
translates into:
@viewport {
width: extend-to-zoom 500px;
height: extend-to-zoom 600px;
}
For a viewport META element that translates
into an @viewport rule with a
non-‘auto’
‘zoom’
declaration and no ‘width’
declaration:
height’
descriptor, add:
width: auto;
width: extend-to-zoom;
to the @viewport rule.
This META element:
<meta name="viewport" content="initial-scale=1.0">
translates into:
@viewport {
zoom: 1.0;
width: extend-to-zoom;
}
This META element:
<meta name="viewport" content="initial-scale=2.0, height=device-width">
translates into:
@viewport {
zoom: 2.0;
width: auto;
height: extend-to-zoom device-width;
}
initial-scale,
minimum-scale, and
maximum-scale propertiesThe properties are translated into
‘zoom’,
‘min-zoom’,
and ‘max-zoom’
respectively with the following translations of values.
[0.1, 10]yes is translated to 1device-width
and device-height
are translated to 10no and unknown values are translated to 0.1For a viewport META element that translates into an
@viewport rule with no ‘max-zoom’ declaration and a non-‘auto’
‘min-zoom’ value that is larger than the ‘max-zoom’ value of the UA stylesheet,
the ‘min-zoom’ declaration value is clamped to the UA stylesheet ‘max-zoom’
value.
user-scalable propertyThe user-scalable property is translated into
‘user-zoom’
with the following value translations.
yes and no are
translated into
‘zoom’ and
‘fixed’ respectively.device-width
and device-height
are mapped to
‘zoom’<-1, 1>, and unknown values,
are mapped to ‘fixed’This META element:
<meta name="viewport" content="width=480, initial-scale=2.0, user-scalable=1">
will translate into this @viewport block:
@viewport {
width: 480px;
zoom: 2.0;
user-zoom: zoom;
}
auto’
for ‘zoom’This section is not normative.
This section presents one way of picking an actual value for the
‘zoom’
descriptor when the used value is
‘auto’.
Given an initial viewport with size (initial-width,
initial-height), and a finite region within the
canvas where
the formatting structure is rendered (rendered-width,
rendered-height). That region is at least as large as the
actual viewport.
Then, if the used value of
‘zoom’ is
‘auto’, let the
actual zoom factor be:
zoom = MAX(initial-width / rendered-width, initial-height / rendered-height)
The actual zoom factor should also be further limited by the [min-zoom, max-zoom] range.
This section is informative
With the term desktop browser below, we mean a browser which has a size of the initial viewport, in CSS pixels, that is at least as large as the smallest viewport or viewing area you would expect a user of a desktop computer to have. In that sense, it could include tablet PC and TV browsers.
For a desktop browser, the recommendation is to have no UA styles. That
means that it will have all descriptors initially set to
‘auto’, and behave as it would have
without support for viewport descriptors if there are no viewport descriptors
in the user or author styles.
For smaller screen UAs like smartphone browsers, the UA could typically set the minimum viewport width to something that is at least as large as the narrowest width an author would expect a desktop user would use to view documents.
@viewport {
min-width: 980px;
}
It is recommended that limitations in zooming capabilities are not reflected in the UA styles but rather only affect the used values for zoom. The min-zoom/max-zoom UA styles mentioned in the Viewport META section are there to give an accurate description of how the Safari browser behaves, not as part of a recommended UA stylesheet.