Content Listing:
- What is a doctype?
- How do I disable the XP image toolbar?
- How do I validate my HTML?
- What is XHTML? Why should I use it?
What is a doctype?
A doctype tells the browser which version of HTML to expect. It also tells it how to parse the page. A page with no doctype goes into quirks mode, and may give some undesired results. A list of all the doctypes can be found at http://www.w3.org/QA/2002/04/valid-dtd-list.html but here are some of the more common ones:
HTML 4.01 Strict, Transitional, and Frameset:
Transitional - This doctype is good for beginners learning to code. It is more forgiving than the strict doctype. Use this if you are just learning how to validate your code.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Strict - This is the best one to use to help ensure your pages are available to all browsers, including text only browser, PDAs, and screen readers.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Frameset - This doctype is needed on the page where you specify your frameset parameters.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
How do I disable the XP image toolbar?
You have two options. The first is using a meta tag to disable the toolbar for all the images on your page.
Or, if you would like to do it for each image individually.
How do I validate my HTML?
You need to run it through the validator at the W3C. Ok, you ran the validator and saw "Fatal Error: No DOCTYPE specified", now what? You need to insert a doctype at the very top of your page. Click here for more info on doctypes.
What if you got "I was not able to extract a character encoding labeling from any of the valid sources for such information. Without encoding information it is impossible to validate the document."? That means you need to tell what type of character encoding you are using. This is the most common one, and should be inserted between your <head> tags.
Now, you will just need to go through the output of the validator correcting the errors that it points out to you, and you'll have a valid page!
What is XHTML? Why should I use it?
XHTML stands for Extensible HyperText Markup Language, and is an extension of normal HTML based on XML (Extensible Markup Language). It is somewhat stricter than HTML, and documents properly marked up in XHTML can be accessible to virtually all users as it is compatible with older versions of HTML and leaves no room for interpretation differences by different web browsers.
The main changes in XHTML 1.0 from a web designer's perspective are:
- All tags must be well formed - that is, all tags must be closed and nest properly, with inner tags being closed before outer ones. HTML does not technically allow overlapping, but it works in most browsers. Empty elements (those with no content, such as <br>) must be closed, but the terminator may be in the same tag (e.g. <br />).
- All tags and attributes must be in lower case - this makes readability easier, and occurs because XML is case-sensitive. (For example, <p> is correct but <P> is not.)
- All attribute values must be quoted. (For example, <td rowspan="3"> is correct but <td rowspan=3> is not.)
For the full list of changes, see http://www.w3.org/TR/xhtml1/#diffs.
Like in HTML, XHTML 1.0 has three doctypes available - strict, transitional and frameset, whereas XHTML 1.1 only allows strict conformance. It is also recommended that an XML declaration be given at the start of each document. XHTML 1.1 is recommended, and a document may look something like this (from http://www.w3.org/TR/xhtml11/conformance.html#s_conform):
Advantages of using XHTML include greater control over document rendering in a range of user agents (normal web browsers and other media such as mobile phones and Braille devices), which consequently leads to better accessibility. XHTML documents can easily be made compatible with existing browsers (see http://www.w3.org/TR/xhtml1/#guidelines) while modules in XHTML 1.1 allow for future proofing. Finally, because XHTML removes many of the ambiguities of HTML 4.01 (such as explicitly not allowing overlapping elements) it should be easier to make documents look the same on a wider range of browsers.
References:
http://www.w3.org/MarkUp/ - W3C activity on (X)HTML
http://www.w3.org/TR/html401/ - HTML 4.01 Specification
http://www.w3.org/TR/xhtml1/ - XHTML 1.0 Specification
http://www.w3.org/TR/xhtml11/ - XHTML 1.1 Specification