@@ -103,9 +103,59 @@ Intrinsic Aspect Ratios: the 'aspect-ratio' property</h3>
103
103
104
104
ISSUE: Clarify interaction with intrinsic size keywords like ''width/min-content'' etc.
105
105
106
- ISSUE: Add examples
106
+ <div class="example">
107
+ This example sets each item in the grid to render as a square,
108
+ determining the number of items and their widths by the available space.
109
+
110
+ <xmp highlight="html">
111
+ <ul>
112
+ <li> …
113
+ <li> …
114
+ <li> …
115
+ <li> …
116
+ </ul>
117
+ </xmp>
118
+ <pre highlight="css">
119
+ ul {
120
+ display: grid;
121
+ grid-template-columns: repeat(auto-fill, minmax(12em, 1fr));
122
+ }
123
+ li {
124
+ aspect-ratio: 1/1;
125
+ overflow: auto;
126
+ }
127
+ </pre>
128
+ </div>
129
+
130
+ <div class="example">
131
+ This example uses the <{iframe}> element’s
132
+ <code> width</code> and <code> height</code> attributes
133
+ to set the 'aspect-ratio' property,
134
+ giving the iframe an aspect ratio to use for sizing
135
+ so that it behaves exactly like an image with that aspect ratio.
136
+ <!-- https://twitter.com/ausi/status/1053013616239288320 -->
137
+ <pre highlight="html">
138
+ <iframe
139
+ src="https://www.youtube.com/embed/0Gr1XSyxZy0"
140
+ width=560
141
+ height=315>
142
+ </pre>
143
+ <pre highlight="css">
144
+ @supports (aspect-ratio: attr(width px) / 1) {
145
+ iframe {
146
+ aspect-ratio: attr(width px) / attr(height px);
147
+ width: 100%;
148
+ height: auto;
149
+ }
150
+ }
151
+ </pre>
152
+ ISSUE: Can we just slip this 'aspect-ratio' rule
153
+ into the UA default style sheet for images,
154
+ so that they have an aspect ratio while they load?
155
+ This would avoid the need for extra reflows after loading.
156
+ </div>
107
157
108
- <h3 id="min/max -ratio">
158
+ <h3 id="from -ratio">
109
159
Aspect Ratio Limits Option A: the ''from-ratio''</h3>
110
160
111
161
<pre class="partial propdef">
@@ -149,7 +199,7 @@ Aspect Ratio Limits Option A: the ''from-ratio''</h3>
149
199
</pre>
150
200
</div>
151
201
152
- <h3 id="min/max-ratio ">
202
+ <h3 id="ar-width-height ">
153
203
Aspect Ratio Limits Option B: the ''ar'' unit</h3>
154
204
155
205
<pre class="partial propdef">
@@ -413,7 +463,7 @@ Contain-fit Sizing: stretching while maintaining an aspect ratio</h3>
413
463
Contain-fit sizing essentially applies stretch-fit sizing,
414
464
but reduces the size of the box in one axis
415
465
to maintain the box’s intrinsic aspect ratio,
416
- similar to the ''contain'' keyword of the 'object-fit' and 'background-size' properties.
466
+ similar to the ''object-fit/ contain'' keyword of the 'object-fit' and 'background-size' properties.
417
467
418
468
First, a target rectangle is determined:
419
469
0 commit comments