Attributes are additional values that adjust their behavior of elements in various ways to meet the criteria the users require.

Some elements do not require attributes like heading tags <h1>, paragraph rag <p> and some others. But most of the HTML tags may have attributes as their characteristics.

Attribute Breakdown

An attribute is combination of two things:

  • Name: Name is the property you want to set. For example, the image <img> element carries an attribute whose name is src and alt.
  • Value: The value is an what you want the value of the property to be set. It always put within quotations.

Attribute names and attribute values are case-insensitive and should be in lowercase.

Basic Attributes

The basic elements of an HTML code are:

Heading: denoted using the <h1>, <h2>, <h3>, <h4>, <h5>, <h6> tags.

Paragraph: denoted using the <p> tag.

Horizontal ruler: denoted using the <hr> tag.

Link: denoted using the <a> (anchor) tag.

List: denoted using the <ul> (unordered list), <ol> (ordered list) and <li> (list element) tags.

Image: denoted using the <img> tag

Divider: denoted using the <div> tag

Span: denoted using the <span> tag

Attribute Example

Below example will demonstrate the basic architecture of HTML Attributes


<!doctype html>  
      <title>HTML Attribute Example</title> 
      <h3 align = "left">This is left aligned</p> 
      <h4 align = "center">This is center aligned</p> 
      <h5 align = "right">This is right aligned</p>