XHTML 5 Reference
Core Attributes and Tags
Here we look at the generic tags and attributes you are likely to find inside of the <body> </body> container in the web page.
The following attributes can be used on almost any tag within the body of your web page.
- class - allows you to attach one or more class names to the tag as a space separated list. The styles associated with the classes mentioned will be applied to style the content of the tag. The order of the classes if you include more than one does not matter since the style precedence is determined by their order within the stylesheet.
- id - allows you to attach a single id to the tag. This works similarly to classes except that ids take precedence over classes and must be unique within the page.
- style - allows you to attach styles directly to the tag which is useful for testing but inappropriate for live web pages.
- title - allows you to attach text to the tag that describes the content. This is normally displayed as a tooltip by most browsers although some display the text in the status bar instead.
- dir - allows you to set a value of 'rtl' for web content using languages that read right to left instead of left to right.
- xml:lang - allows you to specify the language a portion of the page is written in.
The following tags allow you to split your document up into sections which can be formatted and manipulated differently from the other sections of your document. These new wrappers were introduced in XHTML 5 and in XHTML 1.0 you needed to use a div tag with an id or class to try to achieve the same effect.
- <article></article> - a wrapper for articles
- <aside></aside> - a wrapper for less important parts of the page content
- <footer> </footer> - a wrapper to identify the page footer
- <header></header> - a wrapper for the page header
- <section></section> - allows you to break the page content into sections
- <main> </main> - identifies the main content within the page
- <nav> </nav> - identifies the navigation menu
This article written by Stephen Chapman, Felgall Pty Ltd.