Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sql/2024/media/video_adoption.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#standardSQL
# How many pages use <video>?
# video_adoption.sql
# �\x9d� Updated in 2024
# Updated in 2024

SELECT
client,
Expand Down
60 changes: 50 additions & 10 deletions src/content/en/2021/media.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,19 +433,59 @@ When browsers pick a resource to load out of a `srcset`, they first assign every

On a 500-CSS-`px`-wide viewport, these resources will be assigned the following densities:

| Resource | Density |
|---|---|
| `large.jpg` | `1000w` ÷ `500px` = 2x |
| `medium.jpg` | `750w` ÷ `500px` = 1.5x |
| `small.jpg` | `500w` ÷ `500px` = 1x |
<figure>
<table>
<thead>
<tr>
<th>Resource</th>
<th>Density</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>large.jpg</code></td>
<td><code>1000w</code> ÷ <code>500px</code> = 2x</td>
</tr>
<tr>
<td><code>medium.jpg</code></td>
<td><code>750w</code> ÷ <code>500px</code> = 1.5x</td>
</tr>
<tr>
<td><code>small.jpg</code></td>
<td><code>500w</code> ÷ <code>500px</code> = 1x</td>
</tr>
</tbody>
</table>
<figcaption>{{ figure_link(caption="500px densities") }}</figcaption>
</figure>

However, on a 1000-CSS-`px`-wide viewport, these same resources, marked up with the same `srcset` and `sizes` values, will have different densities:

| Resource | Density |
|---|---|
| `large.jpg` | `1000w` ÷ `1000px` = 1x |
| `medium.jpg` | `750w` ÷ `1000px` = 0.75x |
| `small.jpg` | `500w` ÷ `1000px` = 0.5x |
<figure>
<table>
<thead>
<tr>
<th>Resource</th>
<th>Density</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>large.jpg</code></td>
<td><code>1000w</code> ÷ <code>1000px</code> = 1x</td>
</tr>
<tr>
<td><code>medium.jpg</code></td>
<td><code>750w</code> ÷ <code>1000px</code> = 0.75x</td>
</tr>
<tr>
<td><code>small.jpg</code></td>
<td><code>500w</code> ÷ <code>1000px</code> = 0.5x</td>
</tr>
</tbody>
</table>
<figcaption>{{ figure_link(caption="1000px densities") }}</figcaption>
</figure>

After these densities are calculated, browsers pick the resource with the density that's the best match for the current browsing context. It's safe to say that in this example, the `srcset` did not contain a wide-enough range of resources. Viewports measuring more than 1,000 CSS `px` across, with higher than `1x` densities, are not uncommon; if you're reading this on a laptop, you're probably browsing in such a context, right now. And in these contexts, the best browsers can do is pick `large.jpg`, whose 1x density will still appear blurry on the high-density display.

Expand Down
60 changes: 50 additions & 10 deletions src/content/ja/2021/media.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,19 +433,59 @@ WebPとAVIFの採用が時間とともにどのように変化したか(およ

500-CSS-`px` 幅のビューポートでは、これらのリソースは以下の密度で割り当てられます。

| リソース | 密度 |
|---|---|
| `large.jpg` | `1000w` ÷ `500px` = 2x |
| `medium.jpg` | `750w` ÷ `500px` = 1.5x |
| `small.jpg` | `500w` ÷ `500px` = 1x |
<figure>
<table>
<thead>
<tr>
<th>リソース</th>
<th>密度</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>large.jpg</code></td>
<td><code>1000w</code> ÷ <code>500px</code> = 2x</td>
</tr>
<tr>
<td><code>medium.jpg</code></td>
<td><code>750w</code> ÷ <code>500px</code> = 1.5x</td>
</tr>
<tr>
<td><code>small.jpg</code></td>
<td><code>500w</code> ÷ <code>500px</code> = 1x</td>
</tr>
</tbody>
</table>
<figcaption>{{ figure_link(caption="500px 密度") }}</figcaption>
</figure>

しかし、1000-CSS-`px`幅のビューポートでは、同じリソースが同じ `srcset` と `sizes` 値でマークアップされ、異なる密度を持つことになります。

| リソース | 密度 |
|---|---|
| `large.jpg` | `1000w` ÷ `1000px` = 1x |
| `medium.jpg` | `750w` ÷ `1000px` = 0.75x |
| `small.jpg` | `500w` ÷ `1000px` = 0.5x |
<figure>
<table>
<thead>
<tr>
<th>リソース</th>
<th>密度</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>large.jpg</code></td>
<td><code>1000w</code> ÷ <code>1000px</code> = 1x</td>
</tr>
<tr>
<td><code>medium.jpg</code></td>
<td><code>750w</code> ÷ <code>1000px</code> = 0.75x</td>
</tr>
<tr>
<td><code>small.jpg</code></td>
<td><code>500w</code> ÷ <code>1000px</code> = 0.5x</td>
</tr>
</tbody>
</table>
<figcaption>{{ figure_link(caption="1000px 密度") }}</figcaption>
</figure>

これらの密度が計算された後、ブラウザは現在の閲覧状況にもっともマッチする密度のリソースを選択します。この例では、`srcset`に十分な広さのリソースが含まれていなかったと言ってよいでしょう。CSSのビューポートは1,000pxを超えるものもあり、1xを超える密度も珍しくはない。ノートパソコンでこれを読んでいる人は、今まさに、そんな状況で閲覧していることでしょう。そして、このような状況でブラウザができる最善のことは、`large.jpg`を選ぶことです。その1倍の密度は、高密度のディスプレイではまだぼやけて見えるでしょう。

Expand Down
2 changes: 2 additions & 0 deletions src/static/css/ebook.css
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ section.chapter {
}

section h1 {
/* stylelint-disable-next-line declaration-property-value-no-unknown */
string-set: chapter-title content();
}

Expand All @@ -389,6 +390,7 @@ section.chapter {
}

section.chapter div.subtitle {
/* stylelint-disable-next-line declaration-property-value-no-unknown */
string-set: chapter-subtitle content() " : ";
}

Expand Down