TUTORIALS » HTML / JavaScript » HTML essentials (guided tutorials)XHTML vs HTMLPage 1 of 6You are in page:» 1. A well formed code
Up to this point, you have learned how to use a lot of nice tags to create web pages. You should now be ready to learn the proper way of laying out your tags inside a HTML document. Actually, I think it is a good time for you to move from simple HTML to XHTML...
WHAT!? Don't freak out, it's easy and it is a must if you want to start developing professional web sites. XHTML vs HTMLInstead of pointing out all the differences between HTML and XHTML, I want to start teaching you what the two have in common:
So what's the big deal? What is the difference? Well, keep reading. Remember the internet grew very fast (sometimes too fast) so very often its technologies were developed by different groups, at the same time, without a real standard control. This is what happened with HTML. People around the world started writing their web sites using different "standards" causing millions of HTML coded sites to look different depending on the web browser used (and you don't want that to happen to your site). Also, pages containing inconsistent HMLT code are more difficult to be indexed by search engines (and that is something you don't want either). Today, the www gods (read the World Wide Web Consortium, or W3C) have finally come to an agreement on what the standards to write an HTML page should be, they called this standard: XHTML 1.0. HTML stands for Hypertext Markup Language while XHTML stands for Extensible Hypertext Markup Language. Summarizing, XHTML is nothing but a well formed HTML code. XHTML coded pages should display exactly the same regardless of what web browser you are using (more compatible), and they also should be easier for search engines to read and index. Note: Another major XHTML feature is its ability to include XML syntax (that's where the X comes from). Don't worry about that yet; we will cover it in time. Basic XHTML code structureAny XHTML document must include four mandatory parts:
So a basic XHTML document's code would look something like: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Title of the document</title> </head> <body> Contents of the document </body> </html> <header>and the <body>sections are nested inside the <html>section. Follow to the next pages of this tutorial for an explanation on each section of a XHTML document.
|
|