Hello World

The tradition when teaching a programming language is to introduce the topic with a simple tutorial showing how to get that language to display the text "Hello World". Well XHTML is a way of marking up text rather than a programming language but creating a page that displays "Hello World" is still probably as good a way as any to introduce the subject.

In this series I am going to show you what the source code looks like, provide a link to a web page that uses that exact code so that you can see what it looks like in your web browser, and then discuss what the newly introduced elements of the XHTML markup language actually do.

Let's start with the code of our first page:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml">
Hello World</title>
Hello World.</p>

Next let's see what the Hello World page looks like in your web browser.

There's not a great deal on the page is there. Most of what we have so far is the code that defines the page as being written in XHTML 1.0 with just enough added to display the text "Hello World" in the title bar of your browser and also in the browser window itself.

XHTML markup puts all of the actual markup commands into containers consisting of one or two tags. Each tag starts ith a less than symbol < and ends with a greater than symbol >. The code that we have so far consists of 12 tags. Apart from the first two tags the remainder make up five containers consisting of a start tag and corresponding end tag.

Let's work our way through the statements to see what they do. Don't worry if the code so far looks complicated because most of what we have so far just needs to be coded exactly as we have it without any changes.

As I said before, most of what we have so far will remain unchanged as we develop our XHTML coding skills. For the most part the changes that we will make will be to change the content of the body container and the page title. Eventually we will return to the head container and look at further uses for that part of the web document.


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow