XHTML Attributes

XHTML tags can have attributes.

Attribute values must always be quoted An element can optionally contain one or more attributes in its start tag. An attribute is a name-value pair separated by an equal sign (=). Attribute values must always be quoted.

Example with an image we could have;

<img alt="anything" src="anything.jpg" />

Notice that the attributes, alt & src have been quoted.

ID attribute replaces the Name attribute
Example with the image above

<img alt="anything" src="anything.jpg" name="anything" /> Incorrect
<img alt="anything" src="anything.jpg" id="anything" /> Correct

Attributes cannot be minimized

Example with form items;

 <input type="radio" checked /> Incorrect, checked has no attribute  <input type="radio" checked="checked" /> Correct

Core Attributes

class
class name
Class of the element
id
id name
Unique id for the element
style
style elements
Inline style elements
title
tooltip
Text in a tool tip

Conclusion

That concludes the XHTML Tutorial. As mentioned in the beginning this tutorial is meant to be an introduction to XHTML and not detailed.

At this point you have learned what the requirements are for using XHTML.

The next step is to jump into CSS and apply it with XHTML code.