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: src/content/docs/de/_roundtrip_breakpoints.txt
+18-21
Original file line number
Diff line number
Diff line change
@@ -1,44 +1,41 @@
1
1
---
2
2
title: Breakpoints & Images
3
-
description: Why some (but not all) breakpoints are important for your images
4
-
taskInputHash: 57ab72e7e951b197
3
+
description: Why some (but not all) breakpoints matter for your images
4
+
taskInputHash: 82a3b7247c32f7a5
5
5
lang: en
6
-
ignore: '/* cSpell:locale de,en*/'
7
-
date_published: '2023-03-26'
8
-
date_modified: '2023-03-31'
9
-
date_updated: '2023-03-31'
6
+
date_published: '2023-04-02'
7
+
date_modified: '2023-04-02'
8
+
date_updated: '2023-04-02'
10
9
---
11
10
### Background
12
11
13
-
Small screens and big monitors require different layouts. For `srcset` and `sizes`, we need to know when the layout changes.
12
+
Small screens and large monitors require different layouts. For `srcset` and `sizes`, we need to know at what point the layout changes.
14
13
15
-
Web developers need to decide what should be scaled down, hidden, or moved on smaller screens - or decide what should be expanded, revealed, or added on larger screens. They also have very little information available. Is the user on a tablet or phone in landscape mode or in a small browser window?
14
+
Web developers have to decide what shrinks, disappears, or moves on smaller screens - or what expands, reveals, or adds on larger screens. They also have very little information available. Is the device a tablet or a phone in landscape mode - or a small browser window?
16
15
17
-
We have to choose an arbitrary viewport width at which the layout changes. This is called a **breakpoint**. It can be any number of CSS pixels ([not device pixels](/en/pixels-not-pixels)). Polypane has a [great article](https://polypane.app/blog/the-breakpoints-we-tested-in-2021-and-the-ones-to-test-in-2022/#the-breakpoints-to-develop-on-in-2023) on commonly used breakpoints.
16
+
We have to choose an arbitrary viewport width at which the layout changes. This is called a **breakpoint**. It's an arbitrary number of CSS pixels ([not device pixels](/en/pixels-not-pixels)). Polypane has an [excellent article](https://polypane.app/blog/the-breakpoints-we-tested-in-2021-and-the-ones-to-test-in-2022/#the-breakpoints-to-develop-on-in-2023) on common breakpoints.
18
17
19
-
Some images (like logos, icons, or buttons) can be immune to the layout shifts caused by these breakpoints (and are okay with [srcset density descriptors](/en/density-descriptors)).
18
+
Some images (like logos or icons or buttons) might be immune to the layout shifts caused by these breakpoints (and are fine using [density descriptors in srcset](/en/density-descriptors)).
20
19
21
-
Main content images are limited by the size of their container. Typically, the main area of a page layout is constrained to a specific width, a `max-width`, on the largest screens, but on small screens the main content area fills the entire viewport.
20
+
Main content images are constrained by the size of their container. Typically, a page's main content area is limited to a specific width, a `max-width`, on the largest screens. However, on small screens, the main content area fills the entire viewport.
22
21
23
-
When you have more than one column at some breakpoints, it becomes difficult to compute the effective size rules because the percentage of viewport width taken up by the image changes.
22
+
If you have more than one column at some breakpoints, it becomes harder to calculate effective sizing rules because the percentage of viewport width the image takes up changes.
24
23
25
-
### The easy way
24
+
### The simple method
26
25
27
-
That doesn't mean you should smash your head against the wall. You will likely get very far with the following approach:
26
+
That said, don't worry too much about it. You'll probably do very well with the following approximation:
28
27
29
-
1. At what size does the main column (or the container of the image) stop growing? Until that viewport width, we can use `100vw` for the `sizes` attribute of the image to indicate that the image takes up 100% of the viewport width.
30
-
2. What is the maximum width the container will ever be? We can set that as a fixed `width` for everything else.
28
+
1. At what size does the main column (or the image's container) stop growing? Up to this viewport width, we can use `100vw` for the image's `sizes` attribute to indicate that the image takes up 100% of the viewport width.
29
+
2. What is the largest width the container will ever reach? We can set that as a fixed `width` for everything else.
31
30
32
-
If your answer to 1 is 700px and your answer to 2 is 800px, you can use the following `sizes` attribute:
31
+
If your answer to 1 was 700px and your answer to 2 was 800px, you can use the following `sizes` attribute:
33
32
34
33
```html
35
34
<!-- These are CSS pixels, not device pixels or image pixels. -->
> You would think that the browser could kindly do all these calculations for us based on the CSS. Unfortunately, browsers are aggressively trying to choose an image URL *before* downloading stylesheets. So we have to do the calculations ourselves. And if we're not perfect, that's their problem.
38
+
> One might think that the browser could take care of all these calculations for us nicely based on CSS. Unfortunately, browsers are very eager to choose an image URL *before* downloading stylesheets. Therefore, we need to do the calculations ourselves, and they're okay with it if we don't get it perfect.
42
39
=====================
43
40
44
41
Content prompt used:
@@ -52,7 +49,7 @@ Also carefully translate the title and description for the article; do not use &
52
49
2. Why some (but not all) breakpoints matter for your images
53
50
54
51
Metadata returned1. Breakpoints & Bilder
55
-
2. Warum manche (aber nicht alle) Breakpoints wichtig für Ihre Bilder sind
52
+
2. Warum einige (aber nicht alle) Breakpoints für Ihre Bilder wichtig sind
Copy file name to clipboardexpand all lines: src/content/docs/de/_roundtrip_browser-picks-srcset.txt
+26-22
Original file line number
Diff line number
Diff line change
@@ -1,67 +1,71 @@
1
1
---
2
-
title: How the Browser selects
3
-
description: How the browser selects between images listed in the "srcset" attribute
4
-
taskInputHash: 21fa78dd27583003
2
+
title: How Browsers Choose
3
+
description: How the browser chooses between images listed in the srcset attribute
4
+
taskInputHash: 267a70a857d78c03
5
5
lang: en
6
+
date_published: '2023-04-02'
7
+
date_modified: '2023-04-02'
8
+
date_updated: '2023-04-02'
6
9
---
7
-
How does the browser select between images listed in the "srcset" attribute? Here is a step-by-step guide with examples for both width and density descriptors and how the browser decides based on the device and viewport.
10
+
How does the browser choose between images listed in the srcset attribute? Here is a step-by-step guide with examples for both width and density specifications and how the browser decides based on device and viewport.
8
11
9
-
- When using the "srcset" attribute in HTML, the browser uses a set of rules to select the most suitable image from a list of provided sources. These rules depend on both the display characteristics of the device (resolution, pixel density) and the size of the viewport. The "srcset" attribute allows you to specify different images based on width (using the "w" descriptor) or pixel density (using the "x" descriptor). Let's go through examples for both cases.
12
+
- When using the `srcset` attribute in HTML, the browser uses a set of rules to select the most appropriate image from a list of provided sources. These rules depend on the display properties of the device (resolution, pixel density) and the size of the viewport. The `srcset` attribute allows you to specify different images based on width (using the `w` descriptor) or pixel density (using the `x` descriptor). Let's go through each case with examples.
10
13
11
-
1. Width descriptor ("w"):
14
+
1. Width Descriptor (`w`):
12
15
13
-
Assuming we have the following "srcset" attribute:
a. Determine the DPR (Device Pixel Ratio) of the device. For instance, a standard display has a DPR of 1, while a high-resolution (Retina) display has a DPR of 2 or higher.
26
+
a. Determine the device pixel ratio (DPR) of the device. For example, a standard display has a DPR of 1, while a high-resolution (Retina) display has a DPR of 2 or higher.
24
27
25
-
b. Calculate the effective width for each image in the "srcset". Multiply the width descriptor by the DPR. For a device with a DPR of 1:
28
+
b. Calculate the effective width for each image in the `srcset`. Multiply the width descriptor by the DPR. For a device with a DPR of 1:
26
29
27
30
- example-small.jpg: 400 * 1 = 400px
28
31
29
32
- example-medium.jpg: 800 * 1 = 800px
30
33
31
34
- example-large.jpg: 1600 * 1 = 1600px
32
35
33
-
c. Compare the effective widths to the viewport width. Assuming the viewport width is 420px, the browser selects the smallest image whose effective width is greater than or equal to the viewport width. In this case, "example-medium.jpg" is selected.
36
+
c. Compare the effective widths to the viewport width. Assume the viewport width is 420px. The browser selects the smallest image with an effective width that is greater than or equal to the viewport width. In this case, `example-medium.jpg` is selected.
34
37
35
-
2. Density descriptor ("x"):
38
+
2. Density Descriptor (`x`):
36
39
37
-
Assuming we have the following "srcset" attribute:
a. Determine the DPR (Device Pixel Ratio) of the device. For instance, a standard display has a DPR of 1, while a high-resolution (Retina) display has a DPR of 2 or higher.
50
+
a. Determine the device pixel ratio (DPR) of the device. For example, a standard display has a DPR of 1, while a high-resolution (Retina) display has a DPR of 2 or higher.
48
51
49
-
b. Compare the device's DPR with the "x" descriptors in the "srcset". In this case, we have three images with the following descriptors:
52
+
b. Compare the device DPR with the `x` descriptors in the `srcset`. In this case, we have three images with the following descriptors:
50
53
51
54
- example-1x.jpg: 1x
52
55
53
56
- example-2x.jpg: 2x
54
57
55
58
- example-3x.jpg: 3x
56
59
57
-
c. Select the image with the "x" descriptor closest to the device's DPR. For a device with a DPR of 1, the browser selects "example-1x.jpg". For a device with a DPR of 2, it selects "example-2x.jpg", and so on.
60
+
c. Select the image with the `x` descriptor that is closest to the device DPR. For a device with a DPR of 1, the browser selects `example-1x.jpg`. For a device with a DPR of 2, it selects `example-2x.jpg`, and so on.
58
61
59
-
It is important to note that you can also use the "sizes" attribute in combination with the "srcset" attribute to provide further information on how the image should display at different viewport widths. This is particularly useful when using the width descriptor ("w"). Here is an example:
62
+
It is important to note that you can also use the `sizes` attribute in conjunction with the `srcset` attribute to provide additional information on how the image is displayed at different viewport widths. This is particularly useful with the width descriptor (`w`). Here is an example:
Copy file name to clipboardexpand all lines: src/content/docs/de/_roundtrip_density-descriptors.txt
+23-28
Original file line number
Diff line number
Diff line change
@@ -1,35 +1,30 @@
1
1
---
2
-
title: Density descriptors and srcset
2
+
title: Density Descriptors & Srcset
3
3
description: Examples of using density descriptors in `srcset`
4
-
taskInputHash: 0a85d4f28fee785a
4
+
taskInputHash: d621b8f98c7d0739
5
5
lang: en
6
-
ignore: '/* cSpell:locale de,en*/'
7
-
date_published: '2023-03-26'
8
-
date_modified: '2023-03-31'
9
-
date_updated: '2023-03-31'
6
+
date_published: '2023-04-02'
7
+
date_modified: '2023-04-02'
8
+
date_updated: '2023-04-02'
10
9
---
11
-
Srcset with density descriptors provides a simple and effective method for delivering the most appropriate image for each user's device, improving performance and user experience. This guide will take you through the basics of using srcset with density descriptors and provide markup examples for your convenience.
10
+
Srcset with density descriptors provides a simple and effective method of delivering the most appropriate image to each of the user's devices, thereby improving performance and user experience. This guide will take you through the essential steps for using Srcset with density descriptors and provides markup examples for your convenience.
11
+
## What is Srcset with Density Descriptors?
12
12
13
-
## What is srcset with density descriptors?
13
+
Srcset is an HTML attribute that allows you to specify multiple image sources for a single `<img>` element. Density descriptors (`x`) are used in conjunction with Srcset to provide images with different resolutions based on the pixel density of the user's screen.
14
+
## When should Srcset with Density Descriptors be used?
14
15
15
-
Srcset is an HTML attribute that allows you to specify multiple image sources for a single `<img>` element. Density descriptors (`x`) are used in conjunction with srcset to provide images at different resolutions based on the pixel density of the user's display.
16
+
Using Srcset with density descriptors is particularly useful when you want to:
17
+
1. Provide high-resolution images to high-DPI displays (e.g. Retina displays) while delivering lower-resolution images to standard displays.
18
+
2. Improve page efficiency by delivering the most suitable image size to each user's device.
19
+
## Implementing Srcset with Density Descriptors
16
20
17
-
## When to use srcset with density descriptors?
18
-
19
-
Using srcset with density descriptors is especially useful when you:
20
-
1. Want to provide high resolution images for high DPI displays (e.g. Retina displays) while using lower resolutions for standard displays.
21
-
2. Want to improve page rendering by providing the most appropriate image size for each user's device.
22
-
23
-
## Implementing srcset with density descriptors
24
-
25
-
To use srcset with density descriptors, follow these steps:
21
+
To use Srcset with density descriptors, follow these steps:
26
22
1. Prepare your images in different resolutions.
27
-
2. Add the `srcset` attribute to the `<img>` element, including the image sources and corresponding density descriptors.
28
-
3. Optionally, add the `sizes` attribute to set the size of the image on the screen.
29
-
30
-
### Markup example
23
+
2. Add the "srcset" attribute to the `<img>` element and specify the image sources and corresponding density descriptors.
24
+
3. Add the "sizes" attribute (optional) to specify the size of the image as it will appear on the screen.
25
+
### Markup Example
31
26
32
-
Here is an example of how to implement srcset with density descriptors in your markup:
27
+
Here's an example of how to implement Srcset with Density Descriptors in your markup:
33
28
34
29
```html
35
30
<img src="example-image-1x.jpg"
@@ -38,11 +33,11 @@ Here is an example of how to implement srcset with density descriptors in your m
38
33
```
39
34
40
35
This markup example includes:
41
-
- **src**: The default image source to be displayed when the browser does not support srcset.
42
-
- **srcset**: The list of image sources and their density descriptors (1x, 2x, 3x). The browser chooses the most appropriate image based on the user's display.
36
+
- **src**: The default image source to be displayed when the browser doesn't support Srcset.
37
+
- **srcset**: The list of image sources and their density descriptors (1x, 2x, 3x). The browser selects the most suitable image based on the user's display.
43
38
- **alt**: A description of the image for accessibility purposes.
44
39
45
-
And that's it! You have successfully implemented srcset with density descriptors, improving the performance and user experience of your website.
40
+
And that's it! You have successfully implemented Srcset with density descriptors and improved the performance and user experience of your website.
46
41
=====================
47
42
48
43
Content prompt used:
@@ -55,8 +50,8 @@ Also carefully translate the title and description for the article; do not use &
55
50
1. Density descriptors & srcset
56
51
2. Examples of using density descriptors in `srcset`
57
52
58
-
Metadata returned1. Density-Descriptoren und Srcset
59
-
2. Beispiele für die Verwendung von Density-Descriptoren in `srcset`
53
+
Metadata returned1. Density-Deskriptoren & Srcset
54
+
2. Beispiele zur Verwendung von Density-Deskriptoren in `srcset`
0 commit comments