Attributes

All HTML tags allow attributes such as alignment, colour, width & height, borders, etc to be added to tags. Attributes follow the tag within the braces and are made up of a name and a value pair. There can be multiple attributes with each name/value pair separated by a space. Always place quotes around the attribute values.

See the section on Stylesheets for alternative and additional ways of defining attributes for tags.

Some common attributes are:

  • height
  • width
  • color
  • class
  • id (preferred over 'name')
  • text
  • bgcolor
  • background
  • alt
  • src
  • href
  • link
  • style
  • align
  • border

An example would be <p align="center">Centred text</p>. There are many others so it is useful to have an HTML reference manual handy when creating and editing HTML documents.

Correction form

Enter the error in this field
Enter the correction in this field