- All HTML elements can have attributes.
- Attributes provide additional information about an element.
- Attributes are always specified in the start tag.
Following are Examples of attribute:-
1. href attribute:
href Attribute specified link address.
2. src attribute:
src attribute is used with image tag to provide the path for image to be displayed.
It is used as below:
3. alt attribute:
It is used to show alternate text if image is not displayed.The value of alt
attribute should describe the image.It is used as below:
4. width and height attribute:
Width attribute is used to set the width of an image.Height
attribute used to set the height of an image.It is used as below:
5. HTML style attribute:
With style attribute,we can provide style to our HTML element.
The HTML style attribute has the following syntax: