First time visitor? The tutorials start here.

xHTML and CSS Glossary – Attribute

“Attribute” applies to both xHTML and CSS. Attributes come in two parts, the name and the value.

Attributes in xHTML

In xHTML, an attribute name/value pair would look something like this:

href="http://google.com"

href is the attribute name, while the link to Google is the attribute value. When used inside an anchor link (<a>), it would look something like this:

<a href="http://google.com">Google</a>

xHTML attribute names are followed by an equal sign (=), and the attribute value must be surrounded by a pair of either single or double quotes.

href='http://google.com' (with the single quotes) would work as well.

Attributes in CSS

In CSS, an attribute would look something like this:

font-size: 12px;

font-size is the attribute name, while 12px is the attribute value. Attribute names must be followed by a colon, while a value or group of values must be followed by a semi-colon.


If you found this article useful, please spread the word:
Stumble it! Digg! Tweet it!



Questions or comments?

Please log in to post a comment. Sorry, but it prevents this from happening. If you're not registered yet, you can register here.