The following bit of code is a mickey mouse XHTML file. You can copy this and paste it into a text file of your own, and use it to create a new web page.
Fire up your favourite text editor,
copy the following text into it,
save it with the extension
.html
or .htm
,
and view it in your favourite browser.
<!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" xml:lang="en" lang="en"> <head> <title>My New Web Page</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </head> <body> <h1>My New Web Page</h1> <p> The first paragraph in my document. </p> <h2>An Unordered List</h2> <ul> <li>Item one</li> <li>Item two</li> </ul> <h2>A Hyperlink</h2> <p> <a href="http://www.google.com">Google</a> </p> <hr/> <p> By [your name here] 2010Jul03 </p> </body> </html>
Mess with this. Try changing the "ul" tag above to an "ol" tag.
As of 2007Oct31, I have updated the file to include the language
stuff that the W3C validator wants
attached to the html
tag. It did not use to require this.
If you do not break anything, the prototype above will validate as XHTML 1.0. HTML is based on an SGML Document Type Definition (DTD). XHTML is based on an XML DTD. The most noticeable differences between XHTML and traditional HTML are...
<p>
and
<li>
only have to be opened. The next occurence of
the tag indicates that the previous one is closed. In XHTML, the
closing </p>
and </li>
are
required.
<br>
, <hr>
and <meta>
must be terminated with a slash, as
shown in the example above. These are entered as
<br/>
, <hr/>
and
<meta/>
.