# Tag Attributes

Some tags have mandatory attributes, others are optional, and some are called boolean (which we shall see later in forms).

For example:

<img
	src="https://media.giphy.com/media/nR4L10XlJcSeQ/giphy.gif"
	width="300px"
	height="150px"
	alt=""
/>

The img tag is used to insert images in our documents. It has no content therefore has no closing tag. However it has a mandatory attribute called src (o source) which indicates where the image is located (in this case media.giphy.com). It also has some optional attributes that like width, height and alt.

width and height indicates the space that the image is going to take once shown in the page. If we remove it, the image will appear in its original size.

alt is a substitute text for the image whenever the image can't be seen. Needs to be descriptive. If there's nothing for people to know about the image, we can leave the alt text blank like the example.

src is mandatory as its impossible to diplay an image with no source. The rest of the attributes are optional but they should always be included.

Note: it is ideal that everything regarding the appearance of the content is written in a separate style sheet with a different language called CSS. In order to do that, we should apply an attribute inside the tag called class that will allow us to give different styles to one element with the same value.

<p class="important-text">Iā€™m an important text</p>

Note: the attribute values are written between inverted commas.