HTML Attributes - W3points | w3schools | TutorialPoint | | w3school

Additional information can be added in some HTML elements which is known as an attribute. A unique set of their own attributes is a part of many HTML tags.

  • Attributes are the part of HTML tags which provides to an HTML element.
  • Name/Value pairs like: name=”value” are Attributes.
  • The start tag of an HTML element is always specified by Attributes.

Example 1

<h1> The beginning of a heading is defined by it.

<h1 align=”center”> It specifies the alignment’s additional information.


<body bgcolor=”pink”>

<h1 align=”center”>This is a heading One</h1>



Example 2

<body> This tag specifies body of an HTML document.

<body bgcolor=”pink” > It specifies background color additional information.

<body bgcolor=”pink”>
<h1 align=”center”>This is a heading One</h1>

Example 3

<table> HTML table is defined by this tag.

<table border=”1” > It specifies border’s additional information.

Use Lowercase Attributes

Usually Attributes and attribute values are case-insensitive. Attributes and attribute values in HTML 4 and XHTML are demanding lowercase Attributes and attribute values which is also recommended by World Wide Web Consortium.

Always Quote Attribute Values

In quotes, attributes are always enclosed. Single style quotes are allowed but double style quotes are common. It is necessary to use single quotes when the attribute value itself contains quotes in some situations.


Reserved Attributes

With the following elements, reserved attributes are used. To bind HTML documents to XML documents reserved attributes may be used. Reserved attributes can be used by the following elements:

  • DIV
  • SPAN

Following are the reserved attributes:

  • datasrc – By using URL the source of data can be specified
  • datafld – A property or column can be specified by this attribute.
  • dataformatas – with the help of this attribute using values “html” or “text” the data can be formatted.


Core Attributes

Base, head, html, meta, param, script, style, and tile elements do not use Core Attributes.


Language Attributes

Base, br, frame, frameset, hr, iframe, param, and script elements do not use Language Attributes.


Keyword Attributes


General Attributes

To modify HTML tags attributes are there which does complete customization of a website. Following are some other attributes which are sued with HTML attributes.