Beruflich Dokumente
Kultur Dokumente
People often think it is extremely difficult to make a website. That is not the case! Everyone can learn how to make a website. And if you read on, you will have made one in just one hour. Others believe - just as mistakenly - that expensive and advanced software is needed to make websites. It is true that there are lots of different programs that claim they can create a website for you. Some come closer than others. But if you want it done right, you must do it yourself. Fortunately, it is simple and free and you already have all the software you need. The aim of this tutorial is to give you an easy, yet thorough and correct introduction to how to make websites. The tutorial starts from scratch and requires absolutely no prior knowledge of programming. The tutorial cannot show you everything. So some engagement and a will to experiment are required. But don't worry - learning how to make websites is a lot of fun and gives a tremendous amount of satisfaction when you get it right. How you choose to use the tutorial is up to you. But we suggest you read only two or three lessons a day and take time to experiment with the new things you learn in each lesson. Okay, enough talk. Let's get started!
What is needed?
Most likely you already have everything you need. You have a "browser". A browser is the program that makes it possible to browse and open websites. Right now you are looking at this page in your browser. It is not important which browser you use. The most common is Microsoft Internet Explorer. But there are others such as Opera and Mozilla Firefox and they can all be used. You might have heard about, or even used, programs such as Microsoft FrontPage, Macromedia Dreamweaver or even Microsoft Word, which can - or claim that they can - create websites for you. Forget these programs for now! They are not of any help to you when learning how to code your own website. Instead, you need a simple text editor. If you are using Windows you can use Notepad, which is usually found in the start menu under Programs in Accessories:
If you are not using Windows, you can use a similar simple text editor. For example, Pico (Linux) or TextEdit (Mac). Notepad is a very basic text editing program which is excellent for coding because it does not interfere with what you are typing. It gives you complete control. The problem with many of the programs that claim they can create websites is that they have a lot of standard functions, which you can choose from. The downside is that, everything needs to fit into these standard functions. Thus, this type of programs often cannot create a website exactly as you want it. Or - even more annoyingly - they make changes to your hand-written code. With Notepad or other simple text editors, you only have yourself to thank for your successes and errors. A browser and Notepad (or a similar simple text editor) are all you need to go through this tutorial and make your own websites.
Do I need to be online?
You do not need to be connected to the Internet - neither while reading this tutorial, nor while making your websites. If you want to avoid being online while reading this tutorial, you can either print it out or simply disconnect from the Internet while reading on screen. You can make the website on your computer's hard disk and upload it to the Internet when it is finished.
What's next?
Go to the next lesson and read about HTML before the fun really starts in Lesson 3. 2
What is HTML?
HTML is the "mother tongue" of your browser. To make a long story short, HTML was invented in 1990 by a scientist called Tim Berners-Lee. The purpose was to make it easier for scientists at different universities to gain access to each other's research documents. The project became a bigger success than Tim Berners-Lee had ever imagined. By inventing HTML he laid the foundation for the web as we know it today. HTML is a language, which makes it possible to present information (e.g. scientific research) on the Internet. What you see when you view a page on the Internet is your browser's interpretation of HTML. To see the HTML code of a page on the Internet, simply click "View" in the top menu of your browser and choose "Source".
For the untrained eye, HTML code looks complicated but this tutorial will help you make sense of it all.
Hyper is the opposite of linear. In the good old days - when a mouse was something the cat chased computer programs ran linearly: when the program had executed one action it went to the next line and after that, the next line and so on. But HTML is different - you can go wherever you want and whenever you want. For example, it is not necessary to visit MSN.com before you visit HTML.net. Text is self-explanatory. 3
Mark-up is what you do with the text. You are marking up the text the same way you do in a text editing program with headings, bullets and bold text and so on. Language is what HTML is. It uses many English words.
In this tutorial you will learn so-called XHTML (Extensible HyperText Mark-up Language) which, in short, is a new and more well-structured way of writing HTML. Now you know what HTML (and XHTML) stands for let's get started with what it is all about: making websites.
"Tags"?
Tags are labels you use to mark up the begining and end of an element. All tags have the same format: they begin with a less-than sign "<" and end with a greater-than sign ">". Generally speaking, there are two kinds of tags - opening tags: <html> and closing tags: </html>. The only difference between an opening tag and a closing tag is the forward slash "/". You label content by putting it between an opening tag and a closing tag. HTML is all about elements. To learn HTML is to learn and use different tags.
Will look like this in the browser: Emphasised text. The elements h1, h2, h3, h4, h5 and h6 is used to make headings (h stands for "heading"), where h1 is the first level and normally the largest text, h2 is the second level and normally slightly smaller text, and h6 is the sixth and last in the hierarchy of headings and normally the smallest text. Example 2:
<h1>This is a heading</h1> <h2>This is a subheading</h2>
This is a heading
This is a subheading So, I always need an opening tag and a closing tag?
As they say, there's an exception to every rule and in HTML the exception is that there are a few elements which both open and close in the same tag. These so-called empty elements are not connected to a specific passage in the text but rather are isolated labels, for example, a line break which looks like this: <br />.
How?
In Lesson 1 we looked at what is needed to make a website: a browser and Notepad (or similar text editor). Since you are reading this, you most likely already have your browser open. The only thing you need to do is to open an extra browser window (open the browser one more time) so you can read this tutorial and see your new website at the same time. Also, open Notepad (in Accessories under Programs in the Start menu):
Note how we structured the tags with new lines (using the Enter key) as well as indents (using the Tab key). In principle, it does not matter how you structure your HTML document. But to help you, and others reading your coding, to keep an overview, it is strongly recommended that you structure your HTML in a neat way with line breaks and indents, like the above example. If your document looks like the above example, you have made your first website - a particularly boring website and probably not what you dreamt of when you started this tutorial but still some sort of a website. What you have made will be the basic template for all your future HTML documents.
Note that this title will not appear on the page itself. Anything you want to appear on the page is content and must therefore be added between the "body" tags. As promised, we want the page to say "Hurrah! This is my first website." This is the text that we want to communicate and it therefore belongs in the body section. So in the body section, type the following:
<p>Hurrah! This is my first website.</p>
The p in <p> is short for "paragraph" which is exactly what it is - a text paragraph. Your HTML document should now look like this:
<html> <head> <title>My first website </title> </head> <body> <p>Hurrah! This is my website.</p> </body> </html>
Done! You have now made your first real website! Next all you have to do is to save it to your hard drive and then open it in your browser:
In Notepad choose "Save as..." under "File" in the top menu. Choose "All Files" in the "Save as type" box. This is very important - otherwise, you save it as a text document and not as an HTML document. Now save your document as "page1.htm" (the ending ".htm" indicates that it is an HTML document. ".html" gives the same result. I always use ".htm", but you can choose whichever of the two extensions you prefer). It doesn't matter where you save the document on your hard drive - as long as you remember where you saved it so you can find it again.
In the top menu choose "Open" under "File". Click "Browse" in the box that appears. Now find your HTML document and click "Open".
It now should say "Hurrah! This is my first website." in your browser. Congratulations! If you absolutely want the whole world to see your masterpiece right away, you can jump to Lesson 13 and learn how to upload your page to the Internet. Otherwise, be patient and read on. The fun has just begun.
Always start with the basic template we made in the previous lesson:
<html> <head> <title></title> </head> <body> </body> </html>
In the head section, always write a title: <title>The title of your page</title>. Notice how the title will be shown in the upper left corner of your browser:
The title is especially important because it is used by search engines (such as Google) to index your website and is shown in the search results.
In the body section, you write the actual content of the page. You already know some of the most important elements:
<p>Is used for paragraphs.</p> <em>Emphasis text.</em> <h1>Heading</h1> <h2>Subhead</h2> <h3>Sub-subhead</h3>
Remember, the only way to learn HTML is by trial and error. But don't worry, there is no way you can destroy your computer or the Internet. So keep experimenting - that is the best way to gain experience.
So, get out in the deep water and stand on your own two feet... Okay, maybe not. But give it a go and experiment with what you have learned.
So what's next?
Try to create a few pages yourself. For instance, make a page with a title, a heading, some text, a subhead and some more text. It is perfectly okay to look in the tutorial while you make your first pages. But later, see if you can do it on your own - without looking.
Now what?
Now it is time to learn seven new elements. In the same way you emphasise the text by putting it between the openning tag <em> and the closing tag </em>, you can give stronger emphasis by using the openning tag <strong> and the closing tag </strong>. Example 1:
<strong>Stronger emphasis.</strong>
Will look like this in the browser: Stronger emphasis. Likewise, you can make your text smaller using small: Example 2:
<small>This should be in small.</small>
The difference is that in the first example, we closed the tag we first opened last. This way we avoid confusing both ourselves and the browser.
More elements!
As mentioned in Lesson 3 there are elements which are opened and closed in the same tag. These socalled empty elements are not connected to a specific passage in the text but rather are isolated labels. An example of such a tag is <br /> which creates a forced line break: Example 4:
Some text<br /> and some more text in a new line
Will look like this in the browser: Some text and some more text in a new line Notice that the tag is written as a contraction of an opening and closing tag with an empty space and a forward slash at the end: <br />. Another element that is opened and closed in the same tag is <hr /> which is used to draw a horizontal line ("hr" stands for "horizontal rule"): Example 5:
<hr />
Examples of elements that needs both an opening tag and a closing tag - as most elements do - is ul, ol and li. These elements are used when you want to make lists. is short for "unordered list" and inserts bullets for each list item. ol is short for "ordered list" and numbers each list item. To make items in the list use the li tag ("list item"). Confused? See the examples:
ul
Example 7:
<ul> <li>A list item</li> <li>Another list item</li> </ul>
Example 8:
<ol> <li>First list item</li> <li>Second list item</li> </ol>
will look like this in the browser: 1. First list item 2. Second list item
Lesson 7: Attributes
You can add attributes to a number of elements.
What is an attribute?
12
As you probably remember, elements give structure to a HTML document and tells the browser how you want your website to be presented (for example, <br /> informs the browser to make a line break). In some elements you can add more information. Such additional information is called an attribute. Example 1:
<h2 style="background-color:#ff0000;">My friendship with HTML</h2>
Attributes are always written within a start tag and are followed by an equals sign and the attribute details written between inverted commas. The semicolon after the attribute is for separating different style commands. We will get back to that later.
will show a completely red page in the browser - go ahead and see for yourself. We will explain in greater detail how the colour system works in a few moments. Note that some tags and attributes use US spelling i.e. color instead of colour. It is important that you are careful to use the same spelling as we use in the examples in this tutorial - otherwise, browsers will not be able to understand your codes. Also, don't forget to always close the inverted commas (quotation marks) after an attribute.
13
A hexadecimal colour code consists of # and six digits or letters. There are more than 1000 HEX codes and it is not easy to figure out which HEX code is tied to a specific colour. To make it easier we have made a chart of the 216 most commonly used colours: 216 Web Safe Colour Chart. You can also use the English name for the most common colours (white, black, red, blue, green and yellow). Example 3:
<body style="background-color: red;">
Lesson 8: Links
In this lesson, you will learn how to make links between pages.
Example 1:
<a href="http://www.html.net/">Here is a link to HTML.net</a>
Would look like this in the browser: Here is a link to HTML.net The element a stands for "anchor". And the attribute href is short for "hypertext reference", which specifies where the link leads to - typically an address on the internet or a file name. In the above example the attribute href has the value "http://www.html.net", which is the full address of HTML.net and is called a URL (Uniform Resource Locator). Note that "http://" must always be included in URLs. The sentence "Here is a link to HTML.net" is the text that is shown in the browser as the link. Remember to close the element with an </a>.
Example 2:
<a href="page2.htm">Click here to go to page 2</a>
If page 2 were placed in a subfolder (named "subfolder"), the link could look like this:
Example 3:
<a href="subfolder/page2.htm">Click here to go to page 2</a>
The other way around, a link from page 2 (in the subfolder) to page 1 would look like this:
Example 4:
<a href="../page1.htm">A link to page 1</a>
"../" points to the folder one level up from position of the file from which the link is made. Following the same system, you can also point two (or more) folders up by writing "../../". Did you understand the system? Alternatively, you can always type the complete address for the file (URL).
Use the id attribute to mark the element to which you want to link. For example:
<h1 id="heading1">heading 1</h1>
You can now create a link to that element by using "#" in the link attribute. The "#" must be followed by the id of the tag you want to link to. For example:
<a href="#heading1">Link to heading 1</a>
Example 5:
<html> <head> </head> <body> <p><a href="#heading1">Link to heading 1</a></p> <p><a href="#heading2">Link to heading 2</a></p> <h1 id="heading1">heading 1</h1> <p>Text text text text</p> <h1 id="heading2">heading 2</h1> <p>Text text text text</p> </body> </html>
will look like this in the browser (click on the two links): Link to heading 1 Link to heading 2
Heading 1
Text text text text
Heading 2
Text text text text (Note: An id attribut must start with a letter)
You can also make a link to an e-mail address. It is done in almost the same way as when you link to a document:
Example 6:
<a href="mailto:nobody@html.net">Send an e-mail to nobody at HTML.net</a>
will look like this in the browser: Send an e-mail to nobody at HTML.net The only difference between a link to an e-mail and a link to a file is that instead of typing the address of a document, you type mailto: followed by an e-mail address. When the link is clicked, the default e-mail program opens with a new blank message addressed to the specified e-mail address. Please note that this function will only work if there is an e-mail program installed on your computer. Give it a try!
Example 7:
<a href="http://www.html.net/" title="Visit HTML.net and learn HTML">HTML.net</a>
Would look like this in the browser: HTML.net The title attribute is used to type a short description of the link. If you - without clicking - place the cursor over the link, you will see the text "Visit HTML.net and learn HTML" appears.
See Also
Lesson 9: Images
Wouldn't it be great if you could have an image of actor and music legend David Hasselhoff right in the centre of your page?
All you need do is first tell the browser that you want to insert an image (img) and then where it is located (src, short for "source"). Do you get the picture? Notice how the img element is opened and closed using the same tag. Like the <br /> tag, it is not tied to a piece of text. "david.jpg" is the name of the image file you want to insert in your page. ".jpg" is the file type of the image. Just like the extension ".htm" shows that a file is an HTML document, ".jpg" tells the browser that a file is a picture. There are three different types of image file types you can insert into your pages:
GIF (Graphics Interchange Format) JPG / JPEG (Joint Photographic Experts Group) PNG (Portable Network Graphics)
GIF images are usually best for graphics and drawings, while JPEG images are usually better for photographs. This is for two reasons: first, GIF images only consist of 256 colours, while JPEG images comprise of millions of colours and second, the GIF format is better at compressing simple images, than the JPEG format which is optimized for more complex images. The better the compression, the smaller the size of the image file, the faster your page will load. As you probably know from your own experience, unnecessarily 'heavy' pages can be extremely annoying for the user. Traditionally, the GIF and JPEG formats have been the two dominant image types, but lately, the PNG format has become more and more popular (primarily at the expense of the GIF format). The PNG format contains in many ways the best of both the JPEG and GIF format: millions of colours and effective compressing.
18
Now you can insert the image into one of your own pages. Try it yourself.
Example 3:
<img src="http://www.html.net/logo.png" />
will look like this in the browser (try clicking on the image):
Some browsers let the text of the alt attribute appear as a small pop-up box when the user places their cursor over the picture. Please note that when using the alt attribute, the aim is to provide an alternative description of the picture. The alt attribute should not be used to create special pop-up messages for the user since then visually impaired users will hear the message without knowing what the picture is. The title attribute can be used to add information to the image: 19
Example 6:
<img src="logo.gif" title="Learn HTML from HTML.net" />
If you, without clicking, place the cursor over the image, you will see the text "Learn HTML from HTML.net" appear as a pop-up box. Two other important attributes are width and height: Example 7:
<img src="logo.png" width="141px" height="32px" />
The width and height attributes can be used to set the height and width of an image. The value that is used to set the width and height is pixels. Pixels are the units of measurement used to measure the resolution of screens. (The most common screen resolution is 1024x768 pixels). Unlike centimetres, pixels are relative units of measurement which depend on the resolution of the screen. To a user with a high screen resolution, 25 pixels may correspond to 1 centimetre, while the same 25 pixel in a low screen resolution may correspond to 1.5 centimetres on the screen. If you do not set the width and height, the image will be inserted in its actual size. But with width and height you can manipulate the size: Example 8:
<img src="logo.gif" width="32px" height="32px" />
However, it is worth keeping in mind that the actual size in kilobytes of the image file will remain the same so it will take the same time to load the image as it did before, even though it appears smaller on the screen. Therefore, you should never decrease the image size by using the width and height attributes. Instead, you should always resize your images in an image editing program to make your pages lighter and faster. That said, it is still a good idea to use the width and height attributes because the browser will then be able to detect how much space the image will need in the final page layout before the image is fully downloaded. This allows your browser to set up the page nicely in a quicker way. 20
Is it difficult?
Building tables in HTML may at first seem complicated but if you keep cool and watch your step, it is actually strictly logical - just like everything else in HTML. Example 1:
<table> <tr> <td>Cell <td>Cell </tr> <tr> <td>Cell <td>Cell </tr> </table>
Will look like this in the browser: Cell 1 Cell 2 Cell 3 Cell 4
The opening tag <table> and the closing tag </table> starts and ends the table. Logical. <tr> stands for "table row" and starts and ends horizontal rows. Still logical. <td> is short for "table data". This tag starts and ends each cell in the rows of your table. All simple and logical.
Here is what happens in Example 1: the table starts with a <table>, followed by a <tr>, which indicates the beginning of a new row. Two cells are inserted in this row: <td>Cell 1</td> and <td>Cell 2</td>. The row is hereafter closed with a </tr> and a new row <tr> begins immediately after. The new row also contains two cells. The table is closed with </table>. Just to make it clear: rows are horizontal lines of cells and columns are vertical lines of cells: Cell 1 Cell 2 Cell 3 Cell 4 21
Cell 1 and Cell 2 form a row. Cell 1 and Cell 3 form a column. In the above example, the table has two rows and two columns. However, a table can have an unlimited number of rows and columns. Example 2:
<table> <tr> <td>Cell <td>Cell <td>Cell <td>Cell </tr> <tr> <td>Cell <td>Cell <td>Cell <td>Cell </tr> <tr> <td>Cell <td>Cell <td>Cell <td>Cell </tr> </table>
1</td> 2</td> 3</td> 4</td> 5</td> 6</td> 7</td> 8</td> 9</td> 10</td> 11</td> 12</td>
Will look like this in the browser: Cell 1 Cell 2 Cell 3 Cell 4 Cell 5 Cell 6 Cell 7 Cell 8 Cell 9 Cell 10 Cell 11 Cell 12
Cell 3 Cell 4 The thickness of the border is specified in pixels (See lesson 9) As with images, you can also set the width of a table in pixels - or alternatively in percentage of the screen: Example 4:
<table border="1" width="30%">
This example will be displayed in the browser as a table with the width of 30% of the screen. Try it yourself.
More attributes?
There are lots of attributes for tables. Here are two more:
align: specifies the horizontal alignment of the content in the entire table, in a row or in a single cell. For example, left, center or right. valign: specifies the vertical alignment of the content in a cell. For example, top, middle or bottom.
Example 5:
<td align="right" valign="top">Cell 1</td>
23
Example 1:
<table border="1"> <tr> <td colspan="3">Cell 1</td> </tr> <tr> <td>Cell 2</td> <td>Cell 3</td> <td>Cell 4</td> </tr> </table>
Will look like this in the browser: Cell 1 Cell 2 Cell 3 Cell 4 By setting colspan to "3", the cell in the first row spans three columns. If we instead had set colspan to "2", the cell would only have spanned two columns and it would have been necessary to insert an additional cell in the first row so that the number of columns will fit in the two rows. Example 2:
<table border="1"> <tr> <td colspan="2">Cell 1</td> <td>Cell 2</td> </tr> <tr> <td>Cell 3</td> <td>Cell 4</td> <td>Cell 5</td> </tr> </table>
Will look like this in the browser: Cell 1 Cell 2 Cell 3 Cell 4 Cell 5
24
Will look like this in the browser: Cell 2 Cell 1 Cell 3 Cell 4 In the example above rowspan is set to "3" in Cell 1. This specifies that the cell must span over 3 rows (its own row plus an additional two). Cell 1 and Cell 2 are thereby in the same row, while Cell 3 and Cell 4 form two independent rows. Confused? Well, it is not uncomplicated and it is easy to lose track. Therefore, it might be a good idea to draw the table on a piece of paper before you begin with the HTML. Not confused? Then go ahead and create a couple of tables with both colspan and rowspan on your own.
25
In the example above we use the style attribute to specify the type of font to be used (with the command font-family) and the font size (with the command font-size). Notice how in the last paragraph we set both the font type and size with a separating semicolon.
Show example
In the example above CSS has been inserted in the head section and therefore applies to the entire page. To do this, just use the tag <style type="text/css"> which tells the browser that you are typing CSS. In the example all headings on the page will be in Arial in size 30px. All subheads will in Courier size 15. And all text in normal paragraphs will be in Times New Roman size 8. Another option is to type the CSS in a separate document. With a separate CSS document you can manage the layout of many pages all at once. Pretty smart if you want to change the font type or size on a large website with hundreds or thousands of pages. We won't go into that now but you can learn it later in our CSS tutorial.
26
Try inserting the examples in some of your pages - both as shown above and also as CSS inserted in the head section.
I love CSS
With the property float an element can either be floated to the right or to the left. The following example illustrates the principle: Example 4:
<img src="bill.jpg" alt="Bill Gates" style= "float:left;" /> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat...</p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat... In the example, one element (the image) floats to the left and the other element (the text) fills the hole. With the property position, you can place an element exactly where you want it in your page: Example 5: 27
Show example
In the example the image is placed 50 pixels from the bottom and 10 pixels from the right in the browser. But you can place it exactly where you want it. Give it a try. Pretty easy and pretty cool, eh?
Described below is how you upload your pages to a free account at Angelfire with FileZilla. But the procedure is, more or less, the same for all providers and FTP programs. Open the FTP program while connected to the Internet. Insert "Host Name" ("ftp.angelfire.com" under "Address"), username (under "User") and password (under "Password") and click "Connect". You should now have access to the server. In one side of the program you can see the contents of your computer ("Local Site"), and in the other side, you can see the content of the server ("Remote Site"):
Find your HTML documents and images on your computer (on the "Local site") and transfer them to the server (the "Remote site") by double clicking on them. Now the whole world can see them! (For example, at the address http://www.angelfire.com/folk/htmlnet/page1.htm). Name one of the pages "index.htm" (or "index.html") and it will automatically become the start page. i.e. if you type http://www.angelfire.com/folk/htmlnet (without any filename) you will actually open http://www.angelfire.com/folk/htmlnet/index.htm. In the long run, it might be a good idea to purchase your own domain (for example www.your-name.com or www.your-name.net) and avoid the long and complicated addresses you are being assigned by your Internet provider or from providers of free server space. You can find and purchase domains at for example Speednames or NetworkSolutions.
29
There have been attempts to make a common standard of HTML through the World Wide Web Consortium (W3C) founded by Tim Berners-Lee (yep! the great guy who invented HTML). But it has been a long and tough road. In the old days - when browsers where something you had to pay for - Netscape was the dominate browser. Back then, the most supported HTML standard where called 2.0 and later 3.2. But with a market share of over 90% Netscape did not have to - and did not - care much about common standards. On the contrary, Netscape invented their own strange elements, which did not function in other browsers. For many years Microsoft almost completely ignored the Internet. After a while they took up the competition with Netscape and introduced a browser. The first versions of Microsoft's browser, Internet Explorer, were not any better than Netscape at supporting the HTML standards. But Microsoft chose to give away their browser for free (always a popular thing to do) and Internet Explorer soon became the most popular browser. From version 4 and 5 Microsoft aimed to support more and more of the HTML standards from W3C. Netscape did not manage to develop a new version of their browser and continued to distribute the outdated version 4. The rest is history. Today the HTML standards are called 4.01 and XHTML. Now it is Internet Explorer that has a market share of over 90%. Internet Explorer still has its own strange elements but it also supports the W3C HTML standards. And so do all of the other browsers, such as Mozilla, Opera and Netscape. So, when you code HTML following the W3C standards, you make websites that can be seen in all browsers - both now and in the future. And luckily, what you have learned in this tutorial is a new and stricter and cleaner version of HTML called XHTML.
Besides the Document Type Declaration (the first line in the example above), which tells the browser that you want to write XHTML, you also need to insert some extra information in the html tag with the two attributes xmlns and lang.
30
is short for "XML-Name-Space" and should always have the value http://www.w3.org/1999/xhtml. That is all you need to know. But if you have a big hunger for complicated knowledge you can read more about namespaces on W3C's website.
xmlns
In the lang attribute you state which language the document is written in. For this the ISO 639 standard is used, which lists codes for all the languages in the world. In the example above the language are set to English ("en"). With a DTD the browser knows exactly how it should read and show your HTML. Hence, use the example above as template for all your future HTML documents. The DTD is also important when you want to validate your pages.
First, it is a good idea to maintain order and structure in your HTML documents. By posting well arranged documents you will not only show others your mastery of HTML but will also make it considerably easier for yourself to keep an overview. Stick to the standards and validate your pages. This cannot be stressed enough: Always write clean XHTML, use a DTD and validate your pages on validator.w3c.org. Give your page contents. Remember that HTML is a tool, which enables you to present information on the Internet, so make sure that there is information to present. Pretty pages may look nice but most people use the Internet to find information. Avoid overloading your pages with heavy images and other fancy stuff you have found on the Internet. It slows down the loading of the page and could be confusing for visitors. Pages that take more than 20 seconds to load can lose up to 50% of their visitors. 31
Remember to add your website to search engines/directories so people other than your closest family can find and enjoy it. On the front page of all search engines, you will find a link to add new pages (The most important is Google, but there are also others like DMOZ, Yahoo, AltaVista, AlltheWeb and Lycos). In this tutorial, you have learned to use Notepad, which is a simple and very easy to use editor, but perhaps you will find it helpful to use a more advanced editor which gives a better overview and more possibilities. You can find a summary and reviews of different editors on Download.com.
Search the Internet for examples and articles on HTML. There are lots of websites with great contents on HTML. Read and ask questions in the many discussion boards on the Internet. Two of the best places are the Newsgroups and Experts Exchange. This is where you meet the real experts from whom you can learn a lot. Last, but not least, you should - whenever you feel ready - continue learning CSS in our CSS Tutorial. The only thing left is to wish you hours of fun with your new friend, HTML. See you on the Internet :-)
32