Screen Printing

TUTORIALS » HTML / JavaScript » HTML essentials (guided tutorials)

XHTML vs HTML

Page 5 of 6


The <body> section

<!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" lang="en">

<head>
   <title>Title of the document</title>
</head>

<body>
   Contents of the document
</body>

</html>
The
<body>
section encompasses everything you want to be displayed on screen. All the tags you learned from previous tutorials are to be used here.

  1. Create your first XHTML document (remember, you should still use the .htm or .html extension) and write:
    <!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" lang="en">
    
    <head>
       <title>My first XHTML</title>
    </head>
    
    <body>
       <h1>This is just a test</h1>
       Hello <b>World</b>!
       <br/>
       I like this!
    </body>
    
    </html>
  2. Test your file in your browser.
Tada! Now you have a fully compliant XHTML file.

Look at the top bar of your browser's window, the title of your page should be displayed there.
Remember, from now on we will include in each of our .html documents:
  • the
    <!DOCTYPE>
    declaration
  • the
    <html>
    section
  • the
    <head>
    section
  • the
    <body>
    section
this way, they will have well formed, fully XHTML compliant documents.

More pages of this tutorial → XHTML vs HTML  <123456>

Comments & Questions