Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Embedding Images | Working with Images and Visual Content
HTML Text and Media Foundations

bookEmbedding Images

To display images on your HTML page, you use the img element. This element requires a src attribute, which tells the browser the location of the image file you want to show. You can also add width and height attributes to control the size of the image directly in the HTML, making it easier to manage your page's layout and appearance.

index.html

index.html

copy

Specifying both width and height attributes on your images is important. By doing this, you help browsers reserve the right amount of space for each image before it loads. This improves the performance and stability of your page, preventing content from shifting around as images appear.

question mark

Why is it recommended to specify width and height attributes on img elements?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 1

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:

Can you show me an example of how to use the img element with width and height?

Why is it important to prevent content from shifting as images load?

Are there any best practices for choosing image sizes in HTML?

Awesome!

Completion rate improved to 6.25

bookEmbedding Images

Swipe um das Menü anzuzeigen

To display images on your HTML page, you use the img element. This element requires a src attribute, which tells the browser the location of the image file you want to show. You can also add width and height attributes to control the size of the image directly in the HTML, making it easier to manage your page's layout and appearance.

index.html

index.html

copy

Specifying both width and height attributes on your images is important. By doing this, you help browsers reserve the right amount of space for each image before it loads. This improves the performance and stability of your page, preventing content from shifting around as images appear.

question mark

Why is it recommended to specify width and height attributes on img elements?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 1
some-alt