HTML Attribute

HTML attribute describes the addition features or properties of html element. The html attribute is written in opening tag. Basically it is information or specification about html element. It base on pair of name and value. Name and value both are case sensitive and value is written within quotations. Multiple attributes can be added against a single element, but space should be given between two attributes.

HTML Attribute Syntax

<p attribute_name="value">content</p>

Now we will discuss some of the common attributes as we will proceed further it will become more clearer.

Id Attribute

This attribute is use to give a unique identity to element. By giving id to element it become easier to select or identify the element.

Note: The id of element should be unique, No two elements should have same id.


<!DOCTYPE html>

      text-align: center;
      height: 105px;
      background-color: #28a745;

<p id="para">Welcome to tutorials art</p>

HTML Attribute

Title Attribute

This attribute is used to give a title to element, such that, whenever cursor is placed on that element than that title will be viewed to user. So we can say that it is advisory text about an element.


   <h1 title="heading">Title attribute</h1> 
   <p title="paragraph"> 
     This is a paragraph click on the text to know its title 

Note: Try this code and place the cursor on text to see how the title tag is actually working.

Style Attribute

The style attribute is used to give the styles to element such that color, width ,font, size and many more.


<p style="color: blue;">This is a blue paragraph.</p>

Comments are closed.