8000 csswg-drafts/css-device-adapt/Overview.src.html at c24b230fd9e02b0f8ce19e622035890c52b315c9 · simonwuelker/csswg-drafts · GitHub
Skip to content

Latest commit

 

History

History
executable file
·
1688 lines (1395 loc) · 67.4 KB

File metadata and controls

executable file
·
1688 lines (1395 loc) · 67.4 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
<title>CSS Device Adaptation</title>
<link href="default.css" rel="stylesheet" type="text/css">
<link href="../default.css" rel="stylesheet" type="text/css">
<link href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS]" rel="stylesheet" type="text/css">
</head>
<body class="draft">
<div class="head">
<!--logo-->
<h1>CSS Device Adaptation</h1>
<h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
<dl>
<dt>This version:</dt>
<dd>$Date$ (editor's draft)
<!--<dd><a href="[VERSION]">http://www.w3.org/TR/[YEAR]/WD-css-device-adapt-[CDATE]/</a></dd>-->
<dt>Latest version:</dt>
<dd><a href="http://www.w3.org/TR/css-device-adapt/">http://www.w3.org/TR/css-device-adapt/</a></dd>
<dt>Latest editor's draft:</dt>
<dd><a href="http://dev.w3.org/csswg/css3-device-adapt/">http://dev.w3.org/csswg/css-device-adapt/</a></dd>
<dt>Previous version:</dt>
<dd><a href="http://www.w3.org/TR/2011/WD-css-device-adapt-20110915/">
http://www.w3.org/TR/2011/WD-css-device-adapt-20110915/</a></dd>
<dt>Issues List:</dt>
<dd><a href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&component=Device%20Adaptation">W3C Bugzilla</a></dd>
<dt>Feedback:</dt>
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-device-adapt%5D%20feedback"
>www-style@w3.org</a>
with subject line &ldquo;<kbd>[css-device-adapt]
<var>&hellip; message topic &hellip;</var></kbd>&rdquo;
(<a rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/"
>archives</a>)</dd>
<dt>Editors:</dt>
<dd><a href="mailto:rune@opera.com">Rune Lillesveen</a> (<a href="http://www.opera.com/">Opera Software</a>)</dd>
<dd><a href="mailto:oyvinds@opera.com">Øyvind Stenhaug</a> (<a href="http://www.opera.com/">Opera Software</a>)</dd>
<dd><a href="mailto:florian@rivoal.net">Florian Rivoal</a> (invited expert)</dd>
<dt>Previous Editors:</dt>
<dd><a href="mailto:rbetts@adobe.com">Ryan Betts</a> (<a href="http://www.adobe.com/">Adobe Systems</a>)</dd>
</dl>
<!--copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc">Abstract</h2>
<p>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.</p>
<h2 class="no-num no-toc">Status of this document</h2>
<!--status-->
<h2 class="no-num no-toc">Table of Contents</h2>
<!--toc-->
<h2>Introduction</h2>
<p><em>This section is not normative.</em></p>
<p>CSS 2.1 [[!CSS21]] specifies an
<a href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details">
initial containing block</a> for continuous media that has the dimensions
of the <a href="http://www.w3.org/TR/CSS21/visuren.html#viewport">
viewport</a>. 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
<a href="http://www.w3.org/TR/CSS21/syndata.html#length-units">recommended
</a> by CSS 2.1.</p>
<p>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.</p>
<p>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.</p>
<p>Additionally, an HTML <code class="html">META</code> 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 <code class="html">META</code> tag in CSS.</p>
<h2>Values</h2>
<p>This specification follows the <a
href="http://www.w3.org/TR/css3-syntax/#property-defs">CSS property
definition conventions</a> from [[!CSS3SYN]].</p>
<p>Value types are defined in [[!CSS3VAL]].</p>
<h2>The viewport</h2>
<p>In CSS 2.1 a <a href="http://www.w3.org/TR/CSS21/visuren.html#viewport">viewport</a>
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, <code class="css">@viewport</code> applies
to continuous media, and @page to paged media, and they will not interact
or conflict.</p>
<p>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 <span>initial viewport</span> and the
<span>actual viewport</span>.</p>
<dl>
<dt><dfn>initial viewport</dfn></dt>
<dd>This refers to the viewport before any UA or author styles have
overridden the viewport given by the window or viewing area of the UA.
Note that the initial viewport size will change with the size of the
window or viewing area.</dd>
<dt><dfn>actual viewport</dfn></dt>
<dd>This is the viewport you get after the cascaded viewport descriptors,
and the following <a href="#constraining-procedure">constraining procedure</a>
have been applied.</dd>
</dl>
<p>When the <span>actual viewport</span> cannot fit inside the window or
viewing area, either because the <span>actual viewport</span> is larger
than the <span>initial viewport</span> or the zoom factor causes only parts
of the <span>actual viewport</span> to be visible, the UA should offer a
scrolling or panning mechanism.</p>
<p>It is recommended that initially the upper-left corners of the <span>
actual viewport</span> 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
<code class="property">direction</code> property for the first
<code class="html">BODY</code> element of an HTML or XHTML document. For
other document types, it is the computed
<code class="property">direction</code> for the root element.</p>
<p class="issue">"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
<a href="#ua-stylesheet">UA stylesheet</a> outlined for current mobile
behaviour, and that no UA styles for <code class="css">@viewport</code>
will give "desktop" behaviour per default (actual viewport is initial
viewport).</p>
<h2>The <code class="css">@viewport</code> rule</h2>
<p>The <code class="css">@viewport</code> <a
href="http://www.w3.org/TR/CSS21/syndata.html#at-rules">at-rule</a>
consists of the @-keyword followed by a block of descriptors
describing the viewport.</p>
<p>The descriptors inside an <code class="css">@viewport</code>
rule are per document and there is no inheritance involved. Hence
declarations using the &lsquo;<code class="css">inherit</code>&rsquo;
keyword will be dropped. They work similarly to <code class="css">@page</code>
descriptors and follow the cascading order of CSS. Hence, descriptors in
<code class="css">@viewport</code> rules will override descriptors from
preceding rules. The declarations allow !important which will affect
cascading of descriptors accordingly.
</p>
<p><code class="css">@viewport</code> rules apply to top level documents only.</p>
<div class="example">
<p>This example sets the viewport to at least 320px, but otherwise match
window width if it is wider than 320px. Note that it is enough to set
the width as the height will be resolved from the width when auto.</p>
<pre><!--
-->@viewport {
<!-- --> width: 320px auto;
<!-- -->}<!--
--></pre>
</div>
<h3>Syntax</h3>
<p>The syntax for the <code class="css">@viewport</code> rule is as follows
(using the notation from the <a
href="http://www.w3.org/TR/CSS21/grammar.html">Grammar appendix</a> of CSS
2.1 [[!CSS21]]):</p>
<pre><!--
-->viewport
<!----> : VIEWPORT_SYM S*
<!----> '{' S* declaration? [ ';' S* declaration? ]* '}' S*<!--
-->;</pre>
<p>with the new token:</p>
<pre>@{V}{I}{E}{W}{P}{O}{R}{T} {return VIEWPO 9927 RT_SYM;}</pre>
<p>
where:
</p>
<pre>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</pre>
<p>The <code>viewport</code> non-terminal is added to the <code>stylesheet</code>
production along with the <code>ruleset</code>, <code>media</code>, and
<code>page</code> non-terminals:</p>
<pre><!--
-->stylesheet
<!-- --> : [ CHARSET_SYM STRING ';' ]?
<!-- --> [S|CDO|CDC]* [ import [ CDO S* | CDC S* ]* ]*
<!-- --> [ [ ruleset | media | page | viewport ] [ CDO S* | CDC S* ]* ]*
<!-- --> ;<!--
--></pre>
<p>It is also added to media production to allow
<code class="css">@viewport</code> rules nested inside
<code class="css">@media</code> rules <span class="note">This is extending
the CSS 2.1 syntax. A draft of CSS3 Paged Media also allows page inside
@media.</span>:</p>
<pre><!--
-->media
<!-- --> : MEDIA_SYM S* media_list LBRACE S* [ ruleset | viewport ]* '}' S*
<!-- --> ;<!--
--></pre>
<h2>Viewport descriptors</h2>
<p>This section presents the descriptors that are allowed inside an
<code class="css">@viewport</code> rule. Other descriptors than those
listed here will be dropped.</p>
<p>Relative length values are resolved against initial values. For instance
'em's are resolved against the initial value of the
<code class="property">font-size</code> property. Viewport lengths (vw,
vh, vmin, vmax) are relative to the initial viewport.</p>
<h3>The
&lsquo;<code class="descriptor">min-width</code>&rsquo; and
&lsquo;<code class="descriptor">max-width</code>&rsquo; descriptors</h3>
<table class="descdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn>min-width</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td><span>&lt;viewport-length&gt;</span></td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td><span title="auto!!length">auto</span></td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>Refer to the width of the <span>initial viewport</span></td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual, continuous</td>
</tr>
<tr>
<td><em>Computed&nbsp;value:</em></td>
<td>&lsquo;<code class="css" title="auto!!length">auto</code>&rsquo;,
an absolute length, or a percentage as specified</td>
</tr>
</tbody>
</table>
<table class="descdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn>max-width</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td><span>&lt;viewport-length&gt;</span></td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td><span title="auto!!length">auto</span></td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>Refer to the width of the <span>initial viewport</span></td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual, continuous</td>
</tr>
<tr>
<td><em>Computed&nbsp;value:</em></td>
<td>&lsquo;<code class="css" title="auto!!length">auto</code>&rsquo;,
an absolute length, or a percentage as specified</td>
</tr>
</tbody>
</table>
<p>Specifies the minimum and maximum width of the
<a href="http://www.w3.org/TR/CSS21/visuren.html#viewport">viewport</a>
that is used to set the size of the
<a href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details">
initial containing block</a> where</p>
<p style="margin: 1em"><var><dfn>&lt;viewport-length&gt;</dfn></var> = auto | <var>&lt;length&gt;</var> | <var>&lt;percentage&gt;</var></p>
<p>and the values have the following meanings:</p>
<dl>
<dt>&lsquo;<code class="css"><dfn title="auto!!length">auto</dfn></code>&rsquo;</dt>
<dd>The used value is calculated from the other descriptors' values
according to the
<a href="#constraining-procedure">constraining procedure</a>.</dd>
<dt><var>&lt;length&gt;</var></dt>
<dd>
<p>A non-negative absolute or relative length.</p>
</dd>
<dt><var>&lt;percentage&gt;</var></dt>
<dd>
<p>A percentage value relative to the width or height of the
<span>initial viewport</span> at zoom factor 1.0,
for horizontal and vertical lengths respectively. Must be non-negative.
</p>
</dd>
</dl>
<p>The min-width and max-width descriptors are inputs to the
< 783 a href="#constraining-procedure">constraining procedure</a>.
The width will initially be set as close as possible to the
<span>initial viewport</span> width within the min/max
constraints.</p>
<h3>The
&lsquo;<code class="descriptor">width</code>&rsquo;
shortha 1043D nd descriptor</h3>
<table class="descdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn>width</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td><span>&lt;viewport-length&gt;</span>{1,2}</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td>See individual descriptors</td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>See individual descriptors</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual, continuous</td>
</tr>
<tr>
<td><em>Computed&nbsp;value:</em></td>
<td>See individual descriptors</td>
</tr>
</tbody>
</table>
<p>This is a shorthand descriptor for setting both min-width and max-width.
One <span>&lt;viewport-length&gt;</span> value will set both min-width and max-width
to that value. Two <span>&lt;viewport-length&gt;</span> values will set min-width to
the first and max-width to the second.</p>
<h3>The &lsquo;<code class="descriptor">min-height</code>&rsquo; and
&lsquo;<code class="descriptor">max-height</code>&rsquo; descriptor</h3>
<table class="descdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn>min-height</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td><span>&lt;viewport-length&gt;</span></td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td><span title="auto!!length">auto</span></td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>Refer to the height of the <span>initial viewport</span></td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual, continuous</td>
</tr>
<tr>
<td><em>Computed&nbsp;value:</em></td>
<td>&lsquo;<code class="css" title="auto!!length">auto</code>&rsquo;,
an absolute length, or a percentage as specified</td>
</tr>
</tbody>
</table>
<table class="descdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn>max-height</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td><span>&lt;viewport-length&gt;</span></td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td><span title="auto!!length">auto</span></td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>Refer to the height of the <span>initial viewport</span></td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual, continuous</td>
</tr>
<tr>
<td><em>Computed&nbsp;value:</em></td>
<td>&lsquo;<code class="css" title="auto!!length">auto</code>&rsquo;,
an absolute length, or a percentage as specified</td>
</tr>
</tbody>
</table>
<p>Specifies the minimum and maximum height of the
<a href="http://www.w3.org/TR/CSS21/visuren.html#viewport">viewport</a>
that is used to set the size of the
<a href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details">
initial containing block</a>.</p>
<p>The min-height and max-height descriptors are inputs to the
<a href="#constraining-procedure">constraining procedure</a>.
The height will initially be set as close as possible to the
<span>initial viewport</span> height within the min/max
constraints.</p>
<h3>The &lsquo;<code class="descriptor">height</code>&rsquo; shorthand descriptor</h3>
<table class="descdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn>height</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td><span>&lt;viewport-length&gt;</span>{1,2}</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td>See individual descriptors</td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>See individual descriptors</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual, continuous</td>
</tr>
<tr>
<td><em>Computed&nbsp;value:</em></td>
<td>See individual descriptors</td>
</tr>
</tbody>
</table>
<p>This is a shorthand descriptor for setting both min-height and max-height.
One <span>&lt;viewport-length&gt;</span> value will set both min-height and max-height
to that value. Two <span>&lt;viewport-length&gt;</span> values will set min-height to
the first and max-height to the second.</p>
<h3>The &lsquo;<code class="descriptor" title="zoom!!descriptor">zoom</code>&rsquo; descriptor</h3>
<table class="descdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn>zoom</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td>auto | &lt;number&gt; | &lt;percentage&gt;</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td><span title="auto!!zoom">auto</span></td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>The zoom factor itself</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual, continuous</td>
</tr>
<tr>
<td><em>Computed&nbsp;value:</em></td>
<td>&lsquo;<code class="css" title="auto!!zoom">auto</code>&rsquo;, or a non-negative
number or percentage as specified.</td>
</tr>
</tbody>
</table>
<p>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.</p>
<p>Values have the following meanings:</p>
<dl>
<dt>&lsquo;<code class="css"><dfn title="auto!!zoom">auto</dfn></code>&rsquo;</dt>
<dd>The zoom factor is UA-dependent. The UA may use the size of the area
of the canvas on which the document is rendered to find that initial
zoom factor. See <a href="#handling-auto-zoom">this section</a> for a
proposed way of handling
&lsquo;<code class="css" title="auto!!zoom">auto</code>&rsquo; values
for &lsquo;<code class="descriptor" title="zoom!!descriptor">zoom</code>&rsquo;.</dd>
<dt><var>&lt;number&gt;</var></dt>
<dd>
<p>A non-negative 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.</p>
</dd>
<dt><var>&lt;percentage&gt;</var></dt>
<dd>
<p>A non-negative 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.</p>
</dd>
</dl>
<h3>The &lsquo;<code class="descriptor">min-zoom</code>&rsquo; descriptor</h3>
<table class="descdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn>min-zoom</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td>auto | &lt;number&gt; | &lt;percentage&gt;</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td><span title="auto!!min-zoom">auto</span></td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>The zoom factor itself</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual, continuous</td>
</t A0B2 r>
<tr>
<td><em>Computed&nbsp;value:</em></td>
<td>&lsquo;<code class="css" title="auto!!min-zoom">auto</code>&rsquo;, or a non-negative
number or percentage as specified.</td>
</tr>
</tbody>
</table>
<p>Specifies the smallest allowed zoom factor. It is used as input to the
<a href="#constraining-procedure">constraining procedure</a> to constrain
non-&lsquo;<code class="css" title="auto!!zoom">auto</code>&rsquo;
&lsquo;<code class="descriptor" title="zoom!!descriptor">zoom</code>&rsquo;
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
&lsquo;<code class="descriptor" title="zoom!!descriptor">zoom</code>&rsquo; is
&lsquo;<code class="css" title="auto!!zoom">auto</code>&rsquo;.</p>
<p>Values have the following meanings:</p>
<dl>
<dt>&lsquo;<code class="css"><dfn title="auto!!min-zoom">auto</dfn></code>&rsquo;</dt>
<dd>The lower limit on zoom factor is UA dependant. There will be no minimum
value constraint on the &lsquo;<code class="descriptor"
title="zoom!!descriptor">zoom</code>&rsquo; descriptor used in the
<a href="#constraining-procedure">constraining procedure</a></dd>
<dt><var>&lt;number&gt;</var></dt>
<dd>
<p>A non-negative number limiting the minimum value of the zoom factor.</p>
</dd>
<dt><var>&lt;percentage&gt;</var></dt>
<dd>
<p>A non-negative percentage limiting the minimum value of the zoom factor.</p>
</dd>
</dl>
<h3>The &lsquo;<code class="descriptor">max-zoom</code>&rsquo; descriptor</h3>
<table class="descdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn>max-zoom</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td>auto | &lt;number&gt; | &lt;percentage&gt;</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td><span title="auto!!max-zoom">auto</span></td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>The zoom factor itself</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual, continuous</td>
</tr>
<tr>
<td><em>Computed&nbsp;value:</em></td>
<td>&lsquo;<code class="css" title="auto!!max-zoom">auto</code>&rsquo;, or a non-negative
number or percentage as specified.</td>
</tr>
</tbody>
</table>
<p>Specifies the largest allowed zoom factor. It is used as input to the
<a href="#constraining-procedure">constraining procedure</a> to constrain
non-&lsquo;<code class="css" title="auto!!zoom">auto</code>&rsquo;
&lsquo;<code class="descriptor" title="zoom!!descriptor">zoom</code>&rsquo;
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
&lsquo;<code class="descriptor" title="zoom!!descriptor">zoom</code>&rsquo; is
&lsquo;<code class="css" title="auto!!zoom">auto</code>&rsquo;.</p>
<p>Values have the following meanings:</p>
<dl>
<dt>&lsquo;<code class="css"><dfn title="auto!!max-zoom">auto</dfn></code>&rsquo;</dt>
<dd>The upper limit on zoom factor is UA dependant. There will be no maximum
value constraint on the &lsquo;<code class="descriptor">zoom</code>&rsquo;
descriptor used in the <a href="#constraining-procedure">constraining
procedure</a></dd>
<dt><var>&lt;number&gt;</var></dt>
<dd>
<p>A non-negative number limiting the maximum value of the zoom factor.</p>
</dd>
<dt><var>&lt;percentage&gt;</var></dt>
<dd>
<p>A non-negative percentage limiting the maximum value of the zoom factor.</p>
</dd>
</dl>
<h3>The &lsquo;<code class="descriptor">user-zoom</code>&rsquo; descriptor</h3>
<table class="descdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn>user-zoom</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td>zoom | fixed</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td><span title="zoom!!value">zoom</span></td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>N/A</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual, continuous</td>
</tr>
<tr>
<td><em>Computed&nbsp;value:</em></td>
<td>&lsquo;<code class="css" title="zoom!!value">zoom</code>&rsquo; or
&lsquo;<code class="css">fixed</code>&rsquo; as specified.</td>
</tr>
</tbody>
</table>
<p>Specifies if the zoom factor can be changed by user interaction or not.</p>
<p>Values have the following meanings:</p>
<dl>
<dt>&lsquo;<code class="css"><dfn title="zoom!!value">zoom</dfn></code>&rsquo;</dt>
<dd>The user can interactively change the zoom factor.</dd>
<dt>&lsquo;<code class="css"><dfn>fixed</dfn></code>&rsquo;</dt>
<dd>The user cannot interactively change the zoom factor.</dd>
</dl>
<h3>The &lsquo;<code class="descriptor">orientation</code>&rsquo; descriptor</h3>
<table class="descdef">
<tbody>
<tr>
<td><em>Name:</em></td>
<td><dfn>orientation</dfn></td>
</tr>
<tr>
<td><em>Value:</em></td>
<td>auto | portrait | landscape</td>
</tr>
<tr>
<td><em>Initial:</em></td>
<td><span title="auto!!orientation">auto</span></td>
</tr>
<tr>
<td><em>Percentages:</em></td>
<td>N/A</td>
</tr>
<tr>
<td><em>Media:</em></td>
<td>visual, continuous</td>
</tr>
<tr>
<td><em>Computed&nbsp;value:</em></td>
<td>&lsquo;<code class="css" title="auto!!orientation">auto</code>&rsquo;,
&lsquo;<code class="css">portrait</code>&rsquo;, or
&lsquo;<code class="css">landscape</code>&rsquo; as specified.</td>
</tr>
</tbody>
</table>
<p>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.</p>
<p>Values have the following meanings:</p>
<dl>
<dt>&lsquo;<code class="css"><dfn title="auto!!orientation">auto</dfn></code>&rsquo;</dt>
<dd>The UA automatically chooses the orientation based on the device's
normal mode of operation. The UA may choose to change the orientation
of the presentation when the device is tilted.</dd>
<dt>&lsquo;<code class="css"><dfn>portrait</dfn></code>&rsquo;</dt>
<dd>The document should be locked to portrait presentation.</dd>
<dt>&lsquo;<code class="css"><dfn>landscape</dfn></code>&rsquo;</dt>
<dd>The document should be locked to landscape presentation.</dd>
</dl>
<h2>Constraining viewport descriptor values</h2>
<h3>Definitions</h3>
<p>For the procedure below:</p>
<p>Descriptors refer to the values resolved/constrained to at that point in
the procedure. They are initially resolved to their computed values.
</p>
<p><code class="index" title="width!!resolved">width</code> and
<code class="index" title="height!!resolved">height</code> refer to the
resolved viewport size and not the shorthand descriptors. They are both
initially &lsquo;<code class="css" title="auto!!length">auto</code>&rsquo;.
</p>
<p>
<code>MIN/MAX</code> computations where one of the arguments is
&lsquo;<code class="css">auto</code>&rsquo; resolve to the other argument.
For instance, <code>MIN(0.25, 'auto') = 0.25</code>, and
<code>MAX(5, 'auto') = 5</code>.
</p>
<p>
<code class="index" title="width!!initial">initial-width</code> is the
width of the <span>initial viewport</span> in pixels at zoom factor 1.0.
</p>
<p>
<code class=& A835 quot;index" title="height!!initial">initial-height</code> is the
height of the <span>initial viewport</span> in pixels at zoom factor 1.0.
</p>
<h3 id="constraining-procedure">The procedure</h3>
<p>The used values are resolved from the computed values going
through the steps below.</p>
<p>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
<span>initial viewport</span> is resized.</p>
<p>However, Media Queries and Device Adaption are <dfn title="Specifications
whose evaluations are both affected by the same changes to the user
environment, and so always must be evaluated together in order to ensure
proper rendering.">tethered specifications</dfn>. As a result, UAs that also
support <a href="http://www.w3.org/TR/css3-mediaqueries/">Media Queries</a>
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.</p>
<h4 class="no-num no-toc">Resolve <code title="min-zoom!!resolved">min-zoom</code>
and <code title="max-zoom!!resolved">max-zoom</code> values</h4>
<ol>
<li>If <code title="min-zoom!!resolved">min-zoom</code> is not
&lsquo;<code class="css" title="auto!!min-zoom">auto</code>&rsquo; and
<code title="max-zoom!!resolved">max-zoom</code> is not
&lsquo;<code class="css" title="auto!!max-zoom">auto</code>&rsquo;,
set <code>max-zoom = MAX(min-zoom, max-zoom)</code></li>
</ol>
<h4 class="no-num no-toc">Constrain <code title="zoom!!resolved">zoom</code>
value to the <code>[min-zoom, max-zoom]</code> range</h4>
<ol id="ol2">
<li>If <code title="zoom!!resolved">zoom</code> is not
&lsquo;<code class="css" title="auto!!zoom">auto</code>&rsquo;,
set <code>zoom = MAX(min-zoom, MIN(max-zoom, zoom))</code></li>
</ol>
<h4 id="resolve-px" class="no-num no-toc">Resolve non-&lsquo;<code class="css" title="auto!!length">auto</code>&rsquo; lengths to pixel lengths</h4>
<ol id="ol3">
<li>Resolve absolute lengths and percentages to pixel values for the
&lsquo;<code class="descriptor">min-width</code>&rsquo;,
&lsquo;<code class="descriptor">max-width</code>&rsquo;,
&lsquo;<code class="descriptor">min-height</code>&rsquo;, and
&lsquo;<code class="descriptor">max-height</code>&rsquo;
descriptors.
</li>
</ol>
<h4 class="no-num no-toc">Resolve initial <code title="width!!resolved">width</code> and
<code title="height!!resolved">height</code> from min/max descriptors</h4>
<ol id="ol4">
<li>If <code title="min-width!!resolved">min-width</code> or
<code title="max-width!!resolved">max-width</code> is not
&lsquo;<code class="css" title="auto!!length">auto</code>&rsquo;, set
<code>width = MAX(min-width, MIN(max-width, initial-width))</code></li>
<li>If <code title="min-height!!resolved">min-height</code> or
<code title="max-height!!resolved">max-height</code> is not
&lsquo;<code class="css" title="auto!!length">auto</code>&rsquo;, set
<code>height = MAX(min-height, MIN(max-height, initial-height))</code></li>
</ol>
<h4 class="no-num no-toc">Resolve <code title="width!!resolved">width</code>
value</h4>
<ol id="ol6">
<li>If <code title="width!!resolved">width</code> and
<code title="height!!resolved">height</code> are both
&lsquo;<code class="css">auto</code>&rsquo;, set <code>width =
initial-width</code></li>
<li>If <code title="width!!resolved">width</code> is
&lsquo;<code class="css">auto</code>&rsquo;, set <code>width = height *
(initial-width / initial-height)</code>, or <code>width = initial-width</code>
if <code class="index" title="height!!initial">initial-height</code> is 0.</li>
</ol>
<h4 class="no-num no-toc">Resolve <code title="height!!resolved">height</code>
value</h4>
<ol id="ol8">
<li>If <code title="height!!resolved">height</code> is
&lsquo;<code class="css">auto</code>&rsquo;, set <code>height = width *
(initial-height / initial-width)</code>, or <code>height = initial-height</code>
if <code class="index" title="width!!initial">initial-width</code> is 0.</li>
</ol>
<h2>Media Queries</h2>
<p>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
<code class="css">@viewport</code> rules on media queries needs extra
attention.</p>
<p>From the Media Queries specification [[!MEDIAQ]]:</p>
<blockquote><p>&ldquo;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 &lsquo;device-aspect-ratio&rsquo; will be based
on the default aspect ratio of the user agent.&rdquo;</p></blockquote>
<p>The UA must however cascade <code class="css">@viewport</code> rules
separately with the <span>initial viewport</span> size used for
evaluating media feature expressions and other values that depend on the
viewport size to avoid circular dependencies, but use the actual viewport
size when cascading all other rules.</p>
<p>Procedure for applying CSS rules:</p>
<ol>