Home : Basic HTML/CSS tutorial : More HTML basics : Attributes
< Previous: Introduction


Attributes provide a way to attach extra information to an HTML tag. So far the tags we've seen (such as <p>) haven't needed any such extra information, but other tags do.

What is an attribute?

An attribute is a control that can modify the way an HTML tag works. Attributes have values which describe the desired result. For each HTML tag, there are certain attributes which have effect.

Attribute format

Attributes are included within the triangular brackets of the tag, following the name of the tag and a space. The closing tag </tagname> isn't affected. In all, the format looks like this:

<tagname attribute="value">contained text</tagname>

If this seems a bit abstract, don't worry; the next page includes an example of using attributes to create links between pages.

Multiple attributes

You can have more than one attribute in a single tag:

<tagname attribute1="value1" attribute2="value2">contained text</tagname>