LinkExchange Member | Free Home Pages at GeoCities |
If there's anything on this page that you don't understand, then just use the new form to ask me about it.
This page is for any beginner who wants to learn HTML. It's perfect if you want to know the vital basics before starting a page of your own, or if you just want to know what this HTML thing is that keeps coming up on web pages. Before we start our engaging tour of HTML basics, I think I should tell you what HTML stands for, although you'll probably never need to know; but then again, if you find yourself on a quiz show in years to come... Anyway, it stands for ......... HyperText Mark-up Language.
There's quite a lot of text here, so allow me to give you a menu in order that sir or madam may select at his or her leisure. Click on whatever you want to go there. If you want to learn HTML from the beginning, then it makes far more sense to go throught the page in the order I've written it, but it's up to you.
Where to write the HTML you'll learn Some people prefer to skip this, and return to it at the end.
What tags are A very simple explanation.
The start of an HTML page How to tell a computer that your creation is written in HTML.
The very basic stucture Must-read essentials.
Putting headings on a page Make sure that all-important text stand out.
Size, font, and colour of text How to change the afore mentioned stuff.
Part 2 If you wanna move on, hit this link.
You can write the HTML you'll soon learn in two places:
A page written with HTML is made up of two types of writing: the text that the whole world's gonna see, and what are called "tags". Tags are often thought of as stage directions for the browsers, explaining to the browser how and where to present text. (A browser is a piece of software that interprets HTML, and turns it into a page.) These stage directions (or tags) are always placed in the signs "<" and ">". It is the addition of these tags to text that makes HTML what it is, and not just a text document. There are two types of tags; they follow one of these patterns:
The very first tag that you need to learn is the HTML tag. This follows pattern number 1. The text inside the two tags is always the whole
document. The purpose of the tag is to tell the browser that it is reading
HTML.
eg. <HTML> The whole page, including everything, goes here. </HTML>This is the first HTML tag that you've learnt. Note (mentally or on paper - the choice is yours, but choose wisely my friend) these couple of points:
A web page has two main parts. These are the HEAD, and the BODY (I don't know what happened to the legs). The head is small, and describes the page with details like the title. The body is where everything else goes: text, information about graphics, links to other sites - the lot. They are both wrap-around tags, so you can probably guess how they work, but just to make sure, the head works like this:
eg. <HEAD> Put stuff that describes the page here. </HEAD> eg. <BODY> Put everything else here. </BODY>The only really important detail that needs to go in the head is the title of the page. This (don't expect to be surprised) goes in a wrap-around tag called TITLE.
eg. <TITLE> The title goes here. </TITLE>Nothing in the head of the page will appear on the main screen on a web page. This includes the title. The title is not a heading at the top of your page; it goes in the title-bar, which is the thing right at the very top of the page - assuming you've got the page maximised, you will be looking at the frame of your monitor if you look up any further. It's usually shown as white writing on a blue background. If you are using Netscape, the title-bar at the top of this page will say:
Netscape - [The Absolute Beginner's Guide to HTML]
If, on the other hand, you've taken a left-turn at Browser Junction, and you're using Microsoft's Internet Explorer, the title-bar will say:
The Absolute Beginner's Guide to HTML - Microsoft Internet Explorer
I happen to prefer the latter presentation, but you probably don't care what I think, so I'll get on with filling your mind with HTML.
If you just think up some text that can go in the body, you know everything you need for a super-simple web page. It might go something like this:
eg. <HTML> <HEAD> <TITLE>The Chocolate page</TITLE> </HEAD> <BODY> I eat seven bars of chocolate every day, and I weigh 24 stone. </BODY> </HTML>If you're paying attention, you might have noticed that the TITLE tag wraps around text on one line, while the BODY tag is spread over three lines. This is another one of those things that is just to help you look over what you have written and make corrections or additions: Browsers always ignore breaks you've made by pressing enter - they're stubborn creatures, and only talk with tags. (I'll tell you how to break a line before it's reached its goal (the other side of the screen) later on.) Just remember that it doesn't matter where you end the lines - tags or text - on the Notepad screen, but try to make the structure clear (it's for your own good).
OK, I expect you can see where we're heading now. I mentioned before that the TITLE tag doesn't produce a heading on the main page. To do this, you need to use a heading tag. For a main heading, you would use the H1 tag. The H stands for Heading, and the 1 indicates that the heading is one of most importance. It's another wrap-around tag, and, like all tags that affect text on the page itself, is contained within the body. Just to demonstrate, this is how it looks in the simple page I showed above:
eg. <HTML> <HEAD> <TITLE>The Chocolate page</TITLE> </HEAD> <BODY> <H1>The perils of chocolate</H1> I eat seven bars of chocolate every day, and I weigh 24 stone. </BODY> </HTML>"So if H1 is the most important, what is the least important?", I hear you eagerly crying out. Well, the answer to your question is H6. As the number increases, the headings become less important. This means that an H2 heading is smaller than an H1, and an H3 is smaller than an H2, etc. Numbering the headings like this also helps computers to understand how important they are in the structure of the page.
eg. <HTML> <HEAD> <TITLE>The Chocolate page</TITLE> </HEAD> <BODY> <CENTER><H1>The Perils of Chocolate</H1></CENTER> I eat seven bars of chocolate every day, and I weigh 24 stone. </BODY> </HTML>You can see that the text "The Perils of Chocolate" now has two tags wrapped around it. This raises an important point, so listen, and listen good: When more than one tag is applied to a piece of text, the tags must always be nested in order, and never overlapped.
eg. DO NOT TYPE: <CENTER><H1>The Perils of Chocolate</CENTER></H1;>What is wrong in this is that the tags have been overlapped: The CENTER tag has been opened, then the H1 tag has been opened, but before the H1 tag has been closed, the CENTER tag has been closed. To make this a bit clearer, if you had three tags applied to a piece of text, they must be in the sequence:
eg. <OPEN TAG 1><OPEN TAG 2><OPEN TAG 3> text goes here <CLOSE TAG 3><CLOSE TAG 2><CLOSE TAG 1>If you do it any other way then browsers get confused, and lose their tempers, which means that they don't display your page.
Now you know about structuring your page with the head and body, and you know about titles and headings. What I think comes next is how to change the way the text looks. Many of the alterations that are available in our old favourite - Microsoft Word - are also available for changing text that goes onto web pages. Lots of these changes are made using the wrap-around FONT tag.
eg. <FONT> text that you want the FONT tag to affect </FONT>Left like this, the FONT tag is about as pointless as reading this page, and then deciding you can't be bothered to write any HTML. To affect the text, commands must be added to the opening FONT tag. The SIZE command changes how big the text is.
eg. <FONT SIZE=3> I am in size 3 </FONT>This is the standard size for text. The size of text can vary from 1 through to 7. The different sizes look like this:
Another thing that can be varied is the typeface. This means the the shape of letters. Examples of different typefaces are Arial and Times New Roman. The command needed to change the typeface is FACE.
eg. <FONT FACE="Arial"> When I'm viewed by a browser, I will be in Arial </FONT>This sentence is in Arial.
eg. <FONT COLOR="red"> Red text when viewed with a browser </FONT>There are two disadvantages with this easy method:
<FONT COLOR=#The 6-digit colour number goes here> Text in the chosen colour goes here </FONT>What makes this method so complex is the calculation of the 6-digit number. The first two digits determine the amount of red in the colour; the second two determine the amount of green; and the final pair determine the amount of blue. Easy enough so far, but each 2-digit number must be in hexadecimal. "Hexa-what?!", do I hear you cry? If you want to learn about hexadecimal, then read on. If you've decided that you'll wimp out and stick with the 16 colours that can be used by name (many web-page authors use just those 16 colours), then scroll down to the next rainbow-coloured page divide, and read about the more fundamental stuff. If, however, you want to continue your quest to conquer the evil hexadecimal (although he's a powerful friend to have if you can get him on-side), then read on.
Decimal Hexadecimal 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 A 11 B 12 C 13 D 14 E 15 F 16 10hexadecimal continues in this way, and only starts a new column when the previous one overflows from fifteen items, to sixteen items. And so it goes on:
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D, 1E, 1F, 20... 99, 9A, 9B, 9C, 9D, 9E, 9F, A0, A1, A2, A3... A9, AA, AB, AC, AD, AE, AF, B0... F9, FA, FB, FC, FD, FE, FF, 100...There is only room for two hexadecimal characters in each of the three sections of the 6-digit COLOR number, so the greatest value possible is FF. Without including 0 as a number, FF is the 255th number in hexadecimal. If you now open Paint (Windows 95) or Paintbrush (non-Windows 95), you can see why the number 255 is so special when creating colours. Click on Options on the menu-bar, and then "Edit Colors...". If you are using Windows 95, you will also need to click on "Define Custom Colors..." to get to the all-important screen. Play around with the arrows, and you will see the amount of red, green, and blue in the colour that you are creating will change. (Windows 95 Users - of the six boxes that change values, it is the ones down the right-hand side that matter.) The maximum value that the amount of any of the three key colours can have is 255, or in hexadecimal FF. Isn't it nice when everything slides into place? Play around until you find a combination that creates a colour you like, and then note down the amounts of red, green, and blue in the colour.
eg. You might find a light-blue colour that you like, made up of:
Now you need to convert each number to its hexadecimal equivalent:
<FONT COLOR=#0082FF> text of the chosen shade and colour (this time, a type of light-blue)</FONT>So any text written between the font tags is this colour. If you find changing numbers from decimal to hexadecimal a difficult operation, the you can do one of three things:
eg. <FONT SIZE=4 FACE="Arial" COLOR=#0082FF>all three commands apply to this text</FONT>
Click here to go back to the home page.
Don't hit Back when you see it's Green Mac !