Attributes provide information about content: they are the informational underpinning of elements. Attributes are always placed inside an opening HTML tag, usually as follows:
<tag attribute=" "> … </tag>
Attributes may occassionally be single words (such as
required for form elements or
autoplay for audio and video.
It is a good idea to always place attribute values (which can be numbers, letters, words or file paths) inside double quotes, as shown above. Single quotes may also be used. The quotes may be dropped entirely if the value is a series of characters or numbers without any special characters. This is not an advised practice until you are very experienced.
In the previous example I specified the word SAIT as being an abbreviation, but the tag I used did not say what SAIT was an abbreviation for. The
title attribute is used to specify this:
I am a student at <abbr title="Southern Alberta Institute of Technology">SAIT</abbr>
Photograph by Andi Campbell-Jones, used under a Creative Commons Attribution-NonCommercial-NoDerivs 2.0 Generic license
Enjoy this piece? I invite you to follow me at twitter.com/dudleystorey to learn more.