Writing and validating a frameset 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 frameset document type is the one you really need if your webpage will contain frames. If this is not the case, then you need one of the other document types (transitional or strict).

Read more about the different XHTML document types at our XHTML document types tutorial.

Frameset document step-by-step

NOTE: Make sure all three files in this tutorial are saved in the same directory!

  1. Open notepad by going to Start -> Programs -> Accessories -> Notepad OR go to Start -> Run - Type notepad and press Enter.
    Type in this code:
    <html> <body> Frame 1 </body> </html>
  2. Go to File -> Save -> Click on the 'Save as Type' drop down box and select 'All Files'. Save the file as frame1.html to a directory of your choice (for easy access, the desktop is recommended).
    Same process as above for this code (save the file as frame2.html):
    <html> <body> Frame 2 </body> </html>
    Same process for this code too (save the file as frameset.html):
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/ xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Frameset document</title> </head> <frameset rows="50%, 50%"> <noframes> <body>Your browser does not support frames!</body> </noframes> <frame src="frame1.html" name="frame1" /> <frame src="frame2.html" name="frame2" /> </frameset> </html>
  3. Open your web browser and go to File -> Open -> navigate to your file (the one with the frameset, so it's frameset.html) and open it.
  4. You should now see an XHTML frameset document in your web browser which looks like this:
    XHTML frameset document

The validation process

You've written a frameset XHTML document, now lets validate it!

  1. Go to the W3C Markup Validator, located at http://validator.w3.org.
  2. 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"
  3. 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.
  4. Once your document validates.....you now have a valid XHTML frameset document!! This means "that you have taken the care to create an interoperable Web page" as is stated by the W3C Markup Validator.
© Copyright 2013-2014 Landofcode.com
Terms of use | Privacy policy | Copyright information