Introduction to HTML - Free U 2005
I wrote this tutorial when I taught a Free University class during Winter Study in January 2005.
There are lots of exhautive HTML tutorials available on the Internet, but when you're learning to write HTML, you don't need to know all that. The basics, in my opinion, appear in chapters 1-9. The sections after that are neat things that are less frequently useful. If you are only interested in blog posting, not in making an entire page from scratch, skip sections 1-3.
Note: When I give examples of how your code should look, my tags have spaces in them, like this: < pre >.
This is because if I do it without spaces, your browser interprets it as a tag, and does whatever the tag tells it to do, rather than showing you the tag itself.
When you type tags, or if you copy-paste code from this page to your page, make sure you don't have those spaces!
Table of Contents:
1. Basic knowledge
2. Using a text editor
3. Starting a page
4. Simple style and formatting tags
5. Text alignment
6. Using the "font" tag
7. Hyperlinks
8. Images
9. The pre tag
10. Music and videos
11. Tables
12. Calculations
13. Anchors
14. Building more knowledge
1.1 Basic Knowledge
So you want to write your own Web page, or you want to spice up your blog posts, so you've decided to learn HTML. What does that mean? Here are a few things you should know before you get started.
1.2 HTML
HTML stands for Hyper Text Markup Language. Markup language means that the coding you write affects the appearance of the text, but it doesn’t do anything else. For instance, you can make text big, or bold, or blue, or centered – but you can’t make things move, and you can’t calculate anything (calculation requires putting Javascript code into your HTML, which you will learn below). If you could do those things, it would be more of a programming language.
1.3 Tags
Most of the "coding" you will learn will be in the form of HTML tags. Tags are markers you insert around text to change its appearance. Tags use these symbols: < > with letters between them. If you scan through this document, you will see plenty of tags.
1.4 HTML is a language
And it comes from English. Thus, each time you learn a new tag, I will tell you why the tag has that name. I hope that this will help you to remember the tags, so that it you will be learning how to make a Web page, not just memorizing lots of disconnected symbols.
2. Using a text editor
To write a page in HTML, you only need to use a simple text editor, the simpler the better. Under the Windows OS, you can use Notepad or Wordpad, which you can find in Start > Programs > Accessories.
2.1 Wordpad
When you open up Wordpad, go to File > New… When it asks you to select the document type, select "Text Document." You will notice that some of the toolbars at the top disappear, because you don’t have as many formatting options with just a text document. That’s fine. If you ever copy-paste any text into your Web page document in Wordpad, then the next time you save, it will ask you: "You are about to save the document in a Text-Only format, which will remove all formatting. Are you sure you want to do this?" You should say yes. If this happens multiple times and gets annoying, just close the document and open it up again, and it won’t ask you anymore.
2.2 Notepad
Notepad is simpler to use than Wordpad because the only option is a text document, so you never have to worry about anything in the previous paragraph. It is a much simpler program, and does fewer things. When you begin learning to write HTML, I would recommend using Notepad. The only thing that makes Notepad somewhat preferable is that if you want to open a file you were recently working on, it is right in the File menu, so you don't have to go through Open and then browse to find it.
Important! For both text editors, you must save your page as something.html to turn it into a Web page. If you forget to put the .html, it will just be a text document, so you must always remember .html.
When you are learning HTML, it is good to try out everything you are learning. I have found it very useful to have both my Notepad HTML document and a web browser (i.e. Internet Explorer, Firefox) open when I am writing a page. If you open your HTML document in the browser, then every time you make a change to the Notepad document, you can refresh the Web page and see the change you made. This makes it easy to detect errors, and it capitalizes on the instant gratification of the Internet.
3. Starting a page
When you begin a page in HTML, you must put two important things at the top of your file:
3.1 < HTML >
This tells the Web browser what language you are writing in. If you forget this, you might not see anything on the page. So make sure to put it right at the top, the first thing you type. Then at the very end of your page, you should put