Categories
HTML Web development

HTML Image tag

The HTML Image tag is the last one HTML element which I would like to have a look deeper before we will go further to CSS. The image <img> tag is used to insert an image to the document. 

The HTML image element mustn’t contain any content and doesn’t need a closing tag. The HTML <img> tag has two required attributes: scr (source) and alt (text). 

Example:

<img scr=”siamsecat” alt=”siamse cat” height=”500″ width=”400″>

Output:

To link an image to another website/ HTML document, nest the <img> tag inside <a> tags. 

Attributes: 

alt (text) defines alternative text for the image. Shows when the image can not be displayed. 


height (pixels) defines the height of the image. 


src (URL) defines the source of the image. 


width (pixels) defines the width of the image. 

Enjoy coding!

Leave a Reply