HTML - Images einfügen Titelbild

The HTML tag <img> is used to embed an image in a webpage. Technically, images are not inserted into the webpage; they are linked to the webpage. The <img> tag creates a placeholder for the referenced image.

 

 

 

 

 

The <img> tag is empty, contains only attributes, and has no closing tag. It has two required attributes:

 

    • src - Specifies the path to the image
    • alt - Specifies alternative text for the image

 

Syntax

 

<img src="/url" alt="alternative text">

 

The src attribute

 

The required src attribute specifies the path (URL) to the image. This attribute is mandatory. Browsers that support srcset treat src as an image with a pixel density of 1x, unless another image with this density is listed in srcset or unless srcset contains 'w' descriptors.

                                                                                                                   

The alt attribute

 

The alt attribute provides alternative text that the browser can display instead of the image, for example if it hasn't been downloaded yet, in the event of transmission errors, or if it is not in a supported format. The user may also have image display turned off, or may be using a browser that cannot display images. The text should briefly and meaningfully convey what the image depicts, so that the content it conveys becomes clear.

 

Note: A meaningful description of the image is of fundamental importance, especially for accessibility!

 

Example:

 

<img src="img_Eiffelturm.jpg" alt="Eiffel Tower in Paris">

 

tower

 

 

Do you still have questions about this topic? Or do you need help designing your website from a professional internet agency in Munich? Then feel free to contact us!