Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In our last lesson we talked about this information at the top of the document that needs to get cut and paste into each of your documents, in order for it to be a valid XHTML. Let's take a look at what this is and exactly what it all means. This first line is the XML declaration. You will notice it's XML; it is not XHTML. XHTML is an application of XML and this is the version being used. So this XML declaration has the version of XML and the character encoding that's used in the document. The version will always be 1.0 and the encoding will depend on what language the document is in.
For most Western languages utf-8 will work fine and that's the default. If you're using a language that uses different types of characters then western languages, like for instance Japanese or Chinese or Russian, that uses a different set of characters, then you may want a different character encoding. The next line is the DOCTYPE. This tells the browser what type of document this is, which type of XHTML is being used. This one is XHTML 1.0 Transitional and that's what you'll for most of your standard HTML documents.
The other two types are Strict and Frameset, and we'll look at those in a minute. In a Transitional document, you have available all of the HTML 4 tags. You have Center, you have Table, you have Font and all of the presentation markup, all the tags are available in HTML are available in XHTML 1.0 Transitional. So if we look at this document in the browser we see that there is a yellow box and it has some text in it. So here in the document, we see that yellow box is made by the table element and the text is inside of a paragraph element and it has the font tag for specifying the font and the size.
And that looks like this in the browser. In our strict document, you will notice that the DOCTYPE says XHTML 1.0 Strict. The Strict documents do not have available any of the presentation. The center tag is not there, the table tag is not there, the font tag is not there. All of these things have to be done with style sheets. And so at the top of the document we have a style sheet and then down here is the content. So that document looks like this in the browser.
There is the strict version. You see it's virtually the same as the Transitional version. There is the Transitional and there is the Strict. You can accomplish the same things with style sheets that you can with the tables and the fonts. Finally, the Frameset document is for documents that have frames. We'll cover frames in more detail in a later lesson. There in nutshell, you have three frames available, frame sources. It goes red, yellow and then blue HTML. That looks like this in the browser, having red, yellow and blue.
So those are our document types. Again, you will be using the XHTML 1.0 Transitional document type for most of your documents.
Get unlimited access to all courses for just $25/month.Become a member