HTML Attributes

HTML attributes can added to the HTML tags to provide the more information about tag. Attributes can be useful to decorate the HTML element. Attributes are always specified in the start tag.

HTML tag can contain one or more attributes. Attributes consist of a name and value seperated by an equal(=) sign.

Ex. <img src="demo.jpg"/>

The images are defined with the <img> tag.

The filename of the image source is specified in the src attribute.

Here, src is the attribute and demo.jpg is the attribute value.

Multiple Attributes:

<img src="demo.jpg" alt="This is the Demo image" style="height:30px;width:30px">

In the above example there are multiple attributes like src,alt,style.

Attribute value should be in double or single quotes.

We recommend the attribute in lowercase.