Skip to content

Commit b9fb4a8

Browse files
committed
Use more human-readable descriptions in object-fit.
Refer to cover/constraint sizing in common algos section.
1 parent 5d136e5 commit b9fb4a8

2 files changed

Lines changed: 31 additions & 39 deletions

File tree

css3-images/Overview.html

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,36 +2007,36 @@ <h3 id=object-fit><span class=secno>5.5. </span> Sizing Objects: the
20072007

20082008
<p>The &lsquo;<a href="#object-fit0"><code
20092009
class=property>object-fit</code></a>&rsquo; property specifies how the
2010-
contents of a replaced element should be scaled relative to the box
2011-
established by its used height and width. Not all replaced elements can be
2012-
scaled, but images typically can.
2010+
contents of a replaced element should be fitted to the box established by
2011+
its used height and width.
20132012

20142013
<dl>
20152014
<dt>&lsquo;<code class=css>fill</code>&rsquo;
20162015

2017-
<dd>The object's <a href="#concrete-object-size"><i>concrete object
2018-
size</i></a> is the element's used width and height.
2016+
<dd>The replaced content is sized to fill the element's content box: the
2017+
object's <a href="#concrete-object-size"><i>concrete object size</i></a>
2018+
is the element's used width and height.
20192019

20202020
<dt>&lsquo;<code class=css>contain</code>&rsquo;
20212021

2022-
<dd>The object's <a href="#concrete-object-size"><i>concrete object
2023-
size</i></a> is the largest rectangle that has the object's <a
2024-
href="#intrinsic-aspect-ratio"><i>intrinsic aspect ratio</i></a>, and
2025-
additionally has neither width nor height larger than the replaced
2026-
element's used width and height, respectively.
2022+
<dd>The replaced content is sized to maintain its aspect ratio while
2023+
fitting within the element's content box: its <a
2024+
href="#concrete-object-size"><i>concrete object size</i></a> is resolved
2025+
as a <a href="#contain-constraint"><i>contain constraint</i></a> against
2026+
the element's used width and height.
20272027

20282028
<dt>&lsquo;<code class=css>cover</code>&rsquo;
20292029

2030-
<dd>The object's <a href="#concrete-object-size"><i>concrete object
2031-
size</i></a> the smallest rectangle that has the object's <a
2032-
href="#intrinsic-aspect-ratio"><i>intrinsic aspect ratio</i></a>, and
2033-
additionally has neither width nor height smaller than the replaced
2034-
element's used width and height, respectively.
2030+
<dd>The replaced content is sized to maintain its aspect ratio while
2031+
filling the element's entire content box: its <a
2032+
href="#concrete-object-size"><i>concrete object size</i></a> is resolved
2033+
as a <a href="#cover-constraint"><i>cover constraint</i></a> against the
2034+
element's used width and height.
20352035

20362036
<dt>&lsquo;<code class=css>none</code>&rsquo;
20372037

2038-
<dd>Don't resize the replaced content to fit the element's used width and
2039-
height: determine the object's <a
2038+
<dd>The replaced content is not resized to fit inside the element's
2039+
content box: determine the object's <a
20402040
href="#concrete-object-size"><i>concrete object size</i></a> using the <a
20412041
href="#default-sizing-algorithm"><i>default sizing algorithm</i></a> with
20422042
no specified size, and a <a href="#default-object-size"><i>default object
@@ -2055,12 +2055,6 @@ <h3 id=object-fit><span class=secno>5.5. </span> Sizing Objects: the
20552055
intrinsic aspect ratio, so the concept of "smaller" is well-defined.</p>
20562056
</dl>
20572057

2058-
<p>If the replaced element's content does not have an <a
2059-
href="#intrinsic-aspect-ratio"><i>intrinsic aspect ratio</i></a>, the
2060-
&lsquo;<code class=css>cover</code>&rsquo; and &lsquo;<code
2061-
class=css>contain</code>&rsquo; values are treated as &lsquo;<code
2062-
class=css>fill</code>&rsquo;.
2063-
20642058
<p>If the content does not completely fill the replaced element's content
20652059
box, the unfilled space shows the replaced element's background. Since
20662060
replaced elements always clip their contents to the content box, the

css3-images/Overview.src.html

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,28 +1250,29 @@ <h3 id="object-fit">
12501250
</table>
12511251

12521252
<p>The 'object-fit' property specifies how the contents of a replaced element
1253-
should be scaled relative to the box established by its used height and width.
1254-
Not all replaced elements can be scaled, but images typically can.</p>
1253+
should be fitted to the box established by its used height and width.</p>
12551254

12561255
<dl>
12571256
<dt>''fill''</dt>
1258-
<dd>The object's <i>concrete object size</i> is the element's used width and height.</dd>
1257+
<dd>The replaced content is sized to fill the element's content box: the
1258+
object's <i>concrete object size</i> is the element's used width and
1259+
height.</dd>
12591260

12601261
<dt>''contain''</dt>
1261-
<dd>The object's <i>concrete object size</i> is the largest rectangle that
1262-
has the object's <i>intrinsic aspect ratio</i>, and additionally has neither
1263-
width nor height larger than the replaced element's used width and height,
1264-
respectively.</dd>
1262+
<dd>The replaced content is sized to maintain its aspect ratio while fitting
1263+
within the element's content box: its <i>concrete object size</i> is
1264+
resolved as a <i>contain constraint</i> against the element's used width
1265+
and height.</dd>
12651266

12661267
<dt>''cover''</dt>
1267-
<dd>The object's <i>concrete object size</i> the smallest rectangle that
1268-
has the object's <i>intrinsic aspect ratio</i>, and additionally has neither
1269-
width nor height smaller than the replaced element's used width and height,
1270-
respectively.</dd>
1268+
<dd>The replaced content is sized to maintain its aspect ratio while filling
1269+
the element's entire content box: its <i>concrete object size</i> is
1270+
resolved as a <i>cover constraint</i> against the element's used width
1271+
and height.</dd>
12711272

12721273
<dt>''none''</dt>
1273-
<dd>Don't resize the replaced content to fit the element's used width and
1274-
height: determine the object's <i>concrete object size</i> using the
1274+
<dd>The replaced content is not resized to fit inside the element's content
1275+
box: determine the object's <i>concrete object size</i> using the
12751276
<i>default sizing algorithm</i> with no specified size, and a
12761277
<i>default object size</i> equal to the replaced element's used width and
12771278
height.</dd>
@@ -1286,9 +1287,6 @@ <h3 id="object-fit">
12861287
</dd>
12871288
</dl>
12881289

1289-
<p>If the replaced element's content does not have an <i>intrinsic aspect
1290-
ratio</i>, the ''cover'' and ''contain'' values are treated as ''fill''.</p>
1291-
12921290
<p>If the content does not completely fill the replaced element's content box,
12931291
the unfilled space shows the replaced element's background.
12941292
Since replaced elements always clip their contents to the content box, the

0 commit comments

Comments
 (0)