Header Image

HTML FAQs - Answered!

Content Listing:

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.

<meta http-equiv="imagetoolbar" content="no">

Or, if you would like to do it for each image individually.

<img src="yourimage.gif" galleryimg="no">

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.

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

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:

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):

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>Virtual Library</title>
</head> <body>
<p>Moved to <a href="http://vlib.org/">vlib.org</a>.</p>
</body>
</html>

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