Writing and validating a strict XHTML document
This tutorial is aimed towards Windows users. If you are using another operating system, follow the same instructions using whatever text editor and web browser is available to you.
The strict document type is the one you really need if your webpage will NOT contain any deprecated features such as the <font> tag and will NOT consist of frames. If this is not the case, then you need one of the other document types (transitional or frameset).
Read more about the different XHTML document types at our XHTML document types tutorial.
Strict document step-by-step
Open notepad by going to Start -> Programs -> Accessories -> Notepad OR go to Start -> Run - Type notepad and press Enter.
Type in this code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/ xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Strict document</title> </head> <body> <p>This is a strict XHTML document.</p> </body> </html>
- Go to File -> Save -> Click on the 'Save as Type' drop down box and select 'All Files'. Save the file as strict.html to a directory of your choice (for easy access, the desktop is recommended).
- Open your web browser and go to File -> Open -> navigate to your file and open it.
You should now see an XHTML strict document in your web browser which looks like this:
The validation process
You've written a strict XHTML document, now lets validate it!
- Go to the W3C Markup Validator, located at http://validator.w3.org.
- The W3C Markup Validator gives you the option of validating a document by URL, by File Upload, or by Direct Input. You will be validating the document by File Upload so click on the tab that says "Validate by File Upload" and upload the file. When you are ready to validate click on the button that says "Check"
- If the document did not validate, you will get an error message stating this. The Markup Validator provides a detailed description of the error(s) so you know what went wrong. Possible errors include missing closing tags, tags not closed in the right order, attribute values not quoted properly, a missing <!DOCTYPE> declaration, among others.
- Once your document validates.....you now have a valid XHTML strict document!! This means "that you have taken the care to create an interoperable Web page" as is stated by the W3C Markup Validator.