Home
XHTML (extensible hyper text markup language) V1.0 Strict template
Overview
This page is validated "XHTML 1.0 Strict" formed using XML (extensible markup language). If this document is used as a template and the recommendations followed it should be easy to produce well formed XML and XHTML for web use. When presented with XHTML all main browsers should render the content, with layout dependent on style sheet support. If the XHTML is accessible, text browsers, braille readers, speech synthesisers and a host of other output devices should all be capable of rendering the content accurately. Mozilla 5 can render the XML itself.
The browser looks to the mime-type not the file extension when handling documents. XHTML is mime-type "text/html". Thus an extension of .xhtml served with a mime-type of "text/html" will merely be rendered by a browser as very strict HTML (hyper text markup language), and yet the source will be capable of many things....
For authoring, the main principle is to separate the various parts of the document:
- Omit all style tags and attributes in the XHTML.
- Only include content, structure, script declarations and style sheet declarations in the XHTML.
- All style presentation is done with style sheets.
- All scripts are held externally, to avoid character escaping.
- Form the XHTML well
- Try to remain backward compatible with HTML.
- Validate before use.
Well formed-ness
- Tags must nest correctly (no overlapping).
- Tags and attributes must all be lowercase.
- All attribute values must be surrounded with "double quotes"
- All tags must be closed, even if devoid of content. i.e. <p></p>
- All empty elements (isindex, base, meta, img, br, hr, or spacer) should end />
- img tag must have alt attribute, and must be closed. i.e. <img src="a.gif" alt="a" />
- Attributes must not be minimised. i.e. noshade should be noshade="noshade"
- Certain characters, within content, require escaping. For example:
- > with >
- < with <
- & with &
HTML compatability
- Avoid line breaks. If nescessary use <br /> - note the space
- Avoid multiple whitespace inside attribute values
- Set id="name" and name="name" if one or other is nescessary
name attribute is deprecated for the following tags:
- a
- applet
- form
- frame
- iframe
- img
- map
CSS (cascading style sheets) guidelines
- Use all lowercase
- Both color and background-color must be used if either one is used.
- Use relative dimensions wherever possible.
The way XML and HTML interpret the same CSS varies.
Accessibility
Website level guidelines
- Use the clearest and simplest language appropriate for a site's content.
- Provide information about the general layout of a site. Use navigation mechanisms in a consistent manner.
- Create a style of presentation that is consistent across pages.
- Ensure that content maintains meaning without style sheets, javascripts, or applets.
- Use markup rather than images where possible.
- Use relative CSS dimensions - maintains screen scalability.
Document level guidelines
- Specify the natural language of the document, and any language changes.
- Ensure background and foreground colours are sufficiently contrasting.
- Avoid using tables for layout, unless the content maintains meaning with linearised table.
- Divide large blocks of information into more manageable groups where natural and appropriate.
- Do not use auto-refreshing pages, without user permission
- Specify content-type. Give useful meta information.
Specific guidelines
- Provide a descriptive text equivalent for every non-text element, using terminating punctuation at the end of text descriptions.
- Use header tags for structure only i.e h2 is a subsection of h1.
- Specify the expansion of each abbreviation or acronym in a document where it first occurs. Use title attribute of abbr or acronym elements for subsequent expansion of abbreviations.
- Avoid screen flicker or blinking. 4 to 59 Hertz (centered on 20) can bring on epilepsy.
- For moving content, ensure the ability to freeze and stop it.
- Make programmatic elements such as scripts and applets directly accessible or compatible with assistive technologies. i.e. Ensure that event handlers are input device-independent.
- Do not use new window or popup without warning.
- Avoid parallel word wrapped columns, or provide alternative.
Links
- Between adjacent links insert non-link, printable characters, surrounded by spaces.
- Clearly identify the target of each link. Use title attribute.
- When using a graphic as a link, add a text link also.
Data Tables
- Identify row and column headers.
- Use th, thead, tfoot, and tbody, col and colgroup to group data with meaning.
- Use summary attribute of table element.
- Do not leave empty cells.
- Label element should be adjacent to or above its control element.
- Only one control and label per line.
- Use placeholding characters in all empty edit boxes and text areas.
- Explicitly attach the control and label with the for attribute of label element.
For great accessiblity training: http://www.w3.org/TR/WAI-WEBCONTENT/
Javascript
- Scripts should be removed to external .js files where possible.
- Scripts within the page require character entities to be escaped, which can make for complicated code.
- Tag to insert script into XHTML should read <script src="filename" type="text/javascript">.
Using server-side scripts instead of client-side where possible is likely to increase accessibility, as they are less platform / preference dependent. If you are looking towards XHTML Basic then client scripts are to be dropped completely.
Validation
- Serve as .xhtml mime-type "text/html"
- Check the character encoding at the top of the document.
- Validate online at validator.w3.org
- It is nescessary to test CSS files separately, using the same online validation.
- Mozilla 5 and above will give basic validation for rapid development.
www.computertorture.com
To validate this page: http://validator.w3.org/check?uri=http://www.computertorture.com/xhtml/template.xhtml