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
Copy file name to clipboardExpand all lines: UseCaseComparisons.md
+34-26Lines changed: 34 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -4,27 +4,27 @@ This document is indended to address the use cases addressed by both the `pictur
4
4
Assuming three image “breakpoints” based on maximum widths, using pixel-based values: 400px, 600px, and 800px. The smallest image source has been designated as fallback content.
Assuming three image “breakpoints” intended to remain in sync with a media-query-based layout specced in `em` units.
35
35
36
36
**`picture` Element**
37
-
<picture>
37
+
`<picture>
38
38
<sourcemedia="max-width: 20em"src="image1.jpg">
39
39
<sourcemedia="max-width: 40em"src="image2.jpg">
40
40
<sourcemedia="max-width: 60em"src="image3.jpg">
41
41
<imgsrc="image1.jpg"alt="">
42
-
</picture>
42
+
</picture>`
43
43
44
44
**Extended `srcset`**
45
45
N/A
46
46
47
47
Note: the `em` values above could be manually converted to `px` by the author to ensure that the image breakpoints are within a few pixels of the `em`-based layout media queries, resulting in:
While the `em`-based CSS layout will be reevaulated based on user zoom in all modern browsers (see http://blog.cloudfour.com/the-ems-have-it-proportional-media-queries-ftw/ for a description and functional example) and we can assume the same for the `em`-based image breakpoints, the `px`-based image breakpoints will fall out of sync with the layout when the user zooms in or out.
The two proposals are functionally identical in terms of dealing with display density when independent of the “Viewport Sizes” use case above:
68
+
The two proposals are functionally identical in terms of dealing with display density when independent of the “Viewport Sizes” use case:
69
+
70
+
**`picture` Element**
71
+
`<picture>
72
+
<sourcesrcset="image1.jpg, image2.jpg 2x">
73
+
<imgsrc="image1.jpg"alt="">
74
+
</picture>`
69
75
70
-
<imgsrc="image1.jpg"srcset="image2.jpg 2x">
76
+
**Extended `srcset`**
77
+
`<img src="image1.jpg" srcset="image2.jpg 2x">`
71
78
72
79
73
80
## Display density in conjunction with viewport sizing ##
74
81
Assuming three image “breakpoints” based on maximum widths, using pixel-based values: 400px, 600px, and 800px. The smallest standard resolution image source has been designated as fallback content.
Assuming two image sources indended for display on screen depending on window size, each with a standard and high-definition source, and a single image source intended for printing.
90
97
91
98
**`picture` Element**
92
-
<picture>
99
+
`<picture>
93
100
<sourcemedia="(screen and min-width: 20em)"srcset="image1.jpg, image1-hd.jpg 2x">
94
101
<sourcemedia="(screen and min-width: 40em)"srcset="image2.jpg, image2-hd.jpg 2x">
95
102
<sourcemedia="print"src="image3.jpg">
96
103
<imgsrc="image1.jpg"alt="">
97
-
</picture>
104
+
</picture>`
98
105
99
106
**Extended `srcset`**
100
107
N/A
@@ -103,11 +110,11 @@ N/A
103
110
This is based on the high-contrast mode and ambient light media queries currently being proposed in the CSS WG.
0 commit comments