Attributes

  • Define characteristics for an element
  • Placed within the opening tag
  • Consist of name="value" pairs
  • Value is assigned by use of equals sign =
  • Value is always within doubles quotes

 

Four core attributes:

  • id - uniquely identifies the element
  • class - associates an element to a style sheet
  • style - enables inline styling of the element
  • title - provides a title for the element, displayed as a tooltip

 

Other attributes may be specific to a particular element, e.g.

 

<a href="https://www.google.com">Google Link</a>

 

 

A few other generic attributes, now generally becoming deprecated due to the use of CSS:

 

Attribute Description Value
align Horizontal alignment right, left, center
valign Vertical alignment top, middle, bottom
bgcolor Background colour Numeric, hex, RGB value
background Background image URL
width Specifies width Numeric value
height Specifies height Numeric value

Leave a Reply