HTML Attributes


Attributes are additional information provided by HTML elements.


HTML attributes

  • HTML elements can set attributes
  • Attributes can add additional information to an element
  • Attributes are generally described in the start tag
  • Attributes always appear as name/value pairs, eg: name=”value” .

property instance

HTML links are defined by <a> tags. The address of the link is specified in the href attribute :

example

<a href="http://www.tutorialsbyte.com" > This is a link </a>

HTML attributes commonly refer to attribute values

Property values ​​should always be enclosed in quotes.

Double quotes are the most common, but single quotes are fine.

RemarkTip: In some individual cases, such as the attribute value itself contains double quotes, then you must use single quotes, for example: name=’David “Smith” James’


HTML Tip: Use lowercase attributes

Properties and property values ​​are not case-sensitive.

However, the World Wide Web Consortium recommends lowercase attributes/attribute values ​​in its HTML 4 Recommendation.

Newer versions of (X)HTML require lowercase attributes.


HTML Attributes Reference Manual

See the complete list of HTML attributes: HTML Tag Reference Manual .

The attributes that apply to most HTML elements are listed below:

Attributesdescribe
classDefine one or more classnames for html elements (classnames are imported from style files)
idDefines the unique id of the element
styleSpecifies the inline style of the element
titleAdditional information describing the element (used as a toolbar)

More standard attribute descriptions: HTML Standard Attributes Reference Manual .