From HTML to XHTML
HTML is a text-based language so that it can be displayed, printed, and edited directly using your favorite editor such as Notepad on your PC. Our first HTML page is a very simple one:
Example: ex01-01.htm - Hello World
1: <'html>
2: <'body>
3: Hello World!
4: <'/body>
5: <'/html>
This will display a "Hello World!" message inside your browser. The central pillar of all HTML documents is the markup language commands (sometimes called tag names or elements).
The HTML language element <'html> in line 1 asks the browser to start processing an HTML page or file. The element <'body> in line 2 sets the beginning of the contents of the page. Line 3 is the message you want to display. The slash in line 4 indicates the closure of the <'body> element. Line 5 denotes the closure of the HTML and hence ends the page.
Our second example is a classic one with the elements <'title> and <'div>
Example: ex01-02.htm - A Page With Font And Size
1: <'html>
2: <'head>
3: <'title>
4: My Second HTML Example ex01-02.htm
5: <'/title>
6: <'/head>
7: <'body>
8: <'div style="font-family:arial;font-size:18pt">
9: Hello World!
10: <'/div>
11: <'/body>
12: <'/html>
The <'title> elements between lines 3 and 5 will give the page a title and display it on the title bar of the browser. The <'div> division elements between lines 8 and 10 state that you want to open a new division (similar to a paragraph without an additional line break) with the typeface Arial and a font size of 18pt (i.e., 18 points) displaying the "Hello World!" message. If you
type the page into a text editor such as Notepad (without the line number of course) and
save the page as a file with a file extension ".htm" (e.g., ex01-02.htm)
you can display the page in your favorite browser. For example, on a PC with Microsoft Windows, the browser can be activated to display the page by
opening Windows Explorer (not the browser) and locating the file ex01-02.htm;
double clicking the page file.
Alternatively, you can drag the file from Windows Explorer and drop it into the browser window. The style attribute used in line 8 to specify the font and size of our message is called the CSS. The style used here is referred to as inline style. CSS is a very important subject on the Web. Much more information on CSS will be presented in Chapter 2.
**Always remove the ' sign from tags**