HTML Attributes

The HTML attribute is additional information provided by the HTML element.

HTML attribute features

  • You can set the attributes in the HTML element.
  • HTML attributes are generally described in the start tag.
  • HTML attributes always appear as name / value pairs, such as: name = “value”.

HTML attribute example

The HTML link is defined by the <a> tag. The link address is specified in the href attribute:

<a href=""> Here's a link </a>

Attribute values should always be enclosed in quotation marks.

Double quotes are the most commonly used, but the use of single quotes is no problem.

Notes: In some individual cases, you must use single quotes if the attribute value itself contains double quotes, for example: name = ‘John”ShotGun”Nelson’

HTML attributes use lowercase

Attributes and attribute values are case insensitive.

However, the W3C recommends lowercase attribute / attribute values in its HTML 4 recommendations.The new version of (X) HTML requires the use of lowercase attributes.

HTML Attributes Reference Manual

The following is a list of the attributes that apply to most HTML elements:

classDefine one or more class names for the html element
idThe unique id that defines the element
styleSpecifies the inline style of the element
titleDescribes additional information about the element

Here’s a complete list of HTML attributes: HTML tag reference manual.

Leave a Comment

Your email address will not be published.