leafleafleafDocy banner shape 01Docy banner shape 02Man illustrationFlower illustration

HTML attributes

Estimated reading: 2 minutes 64 views

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” .

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


<a href=”https://www.coding180.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=’John “ShotGun” Nelson’

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:

classDefine one or more classnames (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 .

Leave a Comment