HTML tutorial

From Davidbond.net

Jump to: navigation, search

It's amazing how simple a web page can be. At the simplest level, a page can be as follows:

<html>
  <head>
    <title>Page title</title>
  </head>
  <body>
    Hello World from <a href="http://davidbond.net/">David</a>!
  </body>
</html>

It is advisable to use XHTML, as (like Java) this forces good practice. A simple XHTML page is as follows:

<?xml version="1.0" encoding="iso-8859-1" ?>
<!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" lang="en" xml:lang="en">
  <head>
    <title>Page title</title>
  </head>
  <body>
    <div>
      Hello World from <a href="http://davidbond.net/">David</a>!
    </div>
  </body>
</html>

Note that the basic form are the same, but there's a bit more stuff in there for computers to read.