freeCodeCamp Challenge Guide: Add Images to Your Website

Add Images to Your Website


Problem Explanation

Img HTML elements belongs to the group of the “self-closing” HTML elements: it means that they do not follow the ordinary structure - open tag, put content, close tag - but they have just one tag which works as opening and closing tag:
As all opening tag it still can receive attributes though, and these are the tools you can use to manipulate the tag, put some content in, enhance accessibility, etc.
The main attributes of an img tag are src and alt:
Put here a brief description of the image

Attributes are key value pairs inserted into the tag. The syntax is <tag key1="value1" key2="value2"> </tag> or, in case of self-closing tags, <tag key1="value1" key2="value2" /> - notice that the pairs are separated by a space character, not by a comma.

<img src="insert URL of the image" alt="Cute dog smiling">

Relevant Links

38 Likes