You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The narrow viewport is a problem for documents designed to look good in
38
-
desktop browsers. The result is that mobile browser vendors use a fixed
39
-
initial containing block size that is different from the viewport size,
40
-
and close to that of a typical desktop browser window. In addition to
41
-
scrolling or panning, zooming is often used to change between an overview
42
-
of the document and zoom in on particular areas of the document to read
43
-
and interact with.
44
-
45
-
Certain DOCTYPEs (for instance XHTML Mobile Profile) are used to recognize
46
-
mobile documents which are assumed to be designed for handheld devices,
47
-
hence using the viewport size as the initial containing block size.
48
-
49
-
Additionally, an HTML <code class=html><META></code> tag has been
50
-
introduced for allowing an author to specify the size of the initial
51
-
containing block, and the initial zoom factor directly. It was first
52
-
implemented by Apple for the Safari/iPhone browser, but has since been
53
-
implemented for the Opera, Android, and Fennec browsers. These
54
-
implementations are not fully interoperable and this specification is
55
-
an attempt at standardizing the functionality provided by the
56
-
viewport <code class=html><META></code> tag in CSS.
46
+
by CSS 2.1. Users will likely need to zoom on the content to view it
47
+
comfortably.
48
+
49
+
This mitigation is unneccessary for sites that have been designed to work
50
+
well on small viewports. This specification describes the CSS
51
+
<code class=css>@viewport</code> rule which allows authors to control and
52
+
opt-out of this behavior.
57
53
58
54
Issue: This specification is written from an implementation centric point of view,
59
55
making it arguably difficult to read.
@@ -66,6 +62,65 @@ for a good discussion of these issues.
66
62
Issue: Various issues about this specification and related specifications
67
63
are listed in <a href="https://www.w3.org/Graphics/SVG/WG/wiki/Proposals/Investigation_of_APIs_for_Level_of_detail#The_issues_on_existing_APIs">this report</a>.
68
64
65
+
<h2 id="scenarios">
66
+
Motivating Scenarios</h2>
67
+
68
+
<div class="example">
69
+
In this example, the document can be rendered without issue with any
70
+
size viewport. The author indicates this using the
71
+
<code class=css>@viewport</code> rule.
72
+
73
+
<pre class="lang-html">
74
+
<!doctype html>
75
+
<html>
76
+
<head>
77
+
<title>My Site</title>
78
+
<style>
79
+
@viewport { width: auto; }
80
+
</style>
81
+
</head>
82
+
<body>
83
+
Since this document is just some simple text, it can be rendered
84
+
at any width without issue. The text will just re-wrap as needed
85
+
when viewed in a smaller viewport.
86
+
</body>
87
+
</html>
88
+
</pre>
89
+
</div>
90
+
91
+
<div class="example">
92
+
In this example, the document can be rendered without issue for viewports
93
+
down to 384px, but smaller sizes would clip the diagram. The author
94
+
indicates this using the <code class=css>@viewport</code> rule in
95
+
combination with a media query. When the viewport would be smaller than
96
+
384px, the user agent will select 384px as the initial containing block
97
+
size and scale the resulting layout down to fit the available space.
0 commit comments