Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Responsive Images | Advanced Concepts
Introduction to HTML

bookResponsive Images

Responsive images in HTML are images that automatically adjust their size and resolution to fit the size of the device or viewport they are being displayed on. This is important because the size and resolution of devices can vary greatly, and using responsive images ensures that the images look clear and sharp on all devices.

The srcset attribute allows you to specify multiple versions of an image at different resolutions, and the browser will automatically choose the appropriate version based on the viewport size.

index.html

index.html

copy

In this example, three image versions are specified in the srcset attribute: image-small.jpg, image-medium.jpg, and image-large.jpg.

  • w value indicates the width of each image in pixels;
  • sizes attribute specifies the image's width in different viewport sizes.

Note

Make sure multiple image versions are available at different resolutions. The srcset attribute only works with the img element and is not supported by older browsers. It is important to consider the performance of your website when using responsive images. Loading multiple versions of an image can increase the size of your web page and potentially impact the loading speed.

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 5. Kapitel 5

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Suggested prompts:

Fragen Sie mich Fragen zu diesem Thema

Zusammenfassen Sie dieses Kapitel

Zeige reale Beispiele

Awesome!

Completion rate improved to 3.45

bookResponsive Images

Swipe um das Menü anzuzeigen

Responsive images in HTML are images that automatically adjust their size and resolution to fit the size of the device or viewport they are being displayed on. This is important because the size and resolution of devices can vary greatly, and using responsive images ensures that the images look clear and sharp on all devices.

The srcset attribute allows you to specify multiple versions of an image at different resolutions, and the browser will automatically choose the appropriate version based on the viewport size.

index.html

index.html

copy

In this example, three image versions are specified in the srcset attribute: image-small.jpg, image-medium.jpg, and image-large.jpg.

  • w value indicates the width of each image in pixels;
  • sizes attribute specifies the image's width in different viewport sizes.

Note

Make sure multiple image versions are available at different resolutions. The srcset attribute only works with the img element and is not supported by older browsers. It is important to consider the performance of your website when using responsive images. Loading multiple versions of an image can increase the size of your web page and potentially impact the loading speed.

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 5. Kapitel 5
some-alt