You are on page 1of 1

Images:

We can define images by using <img> tag. Image tag contains the below
attributes.
1) Src : We need to give the path of the image. The path can be
absolute or relative path.
2) Alt : This attribute is used to give some description about the image.
When the image is not available or not properly loaded in the
browser then this text will be displayed.
3) Width : It defines the width of the image.
4) Height: It defines the height of the image.
Example:

<img src="sample.jpg" alt="sample image" width="100" height="100"/>


Attributes:
1. Attributes provide additional information to the html elements.
2. Different html elements have different attributes. Some attributes
are specific to some html elements.
3. Attributes will be used with key value pair.
Ex: AttributeName = value
4. Attribute value can be surrounded with either single quote or double
quotes.
Examples:
Title: This attribute adds title to the html element. Whenever we hover on
a html element a tool tip will appear.

You might also like