Webpage/HTML Basics
I get a lot of questions regarding simple HTML codes and I clean up quite a few webpages with problems because the HTML is not coded correctly. So here are some basic things you might like to know about HTML coding:
The page you are viewing right now is an HTML document. HTML documents look a lot like word processing documents...
You can have bold and italicized, Larger and Smaller, or it could look type-written.
Of course, the HTML code for this looks like a bunch of gibberish...
You can have bold and italicized, Larger and Smaller, or it could look type-written.
So what are all these "" things doing here? When you place a certain thing within these you are making something known as a tag. For example the tag is saying to start bold text, and the tag is saying to stop bold text. The tag with the slash (/) is known as the closing tag. Many opening tags require a following closing tag, but not all do. Tags make up the entire structure of an HTML document.
<b>This Text is Bold</b>
^^^--Opening Tag ^^^^--Closing Tag
Here are two pieces of HTML code, the second of the two has an error in it, what is it?
#1 - Bob jumped OVER the fence.
#1 - Bob jumped <b>OVER</b> the fence.
#2 - Bob jumped UNDER the fence.
#2 - Bob jumped <b>UNDER<b> the fence.
You should have noticed that the second code is missing a slash (/) in the tag after the word UNDER, which causes the web browser to interpret the code as leaving the bold face on! This is a common error, so be careful of it!
Note: Tags in HTML are NOT case sensitive. For example... <title> and <TitLE> both mean the same thing and are interpreted as being the same.
Suggestion: In newer HTML standards, it is -highly suggested- that you keep all tags lowercase, that is, it is better to use <title> than <tItLe> even though both work.
Page Structure
HTML files are just normal text files... they usually have the extension of .htm, .html, or .shtml. HTML documents have two (2) parts, the head and the body. The body is the larger part of the document, as the body of a letter you would write to a friend would be. The head of the document contains the document's title and similar information, and the body contains most everything else.
Example of basic HTML document Structure...
<html>
<head><title>Title goes here</title></head>
<body>Body goes here</body>
</html>
You may find it easier to read if you add extra blank lines such as follows...
<html>
<head>
<title>Title goes here</title>
</head>
<body>
Body goes here
</body>
</html>
Note: Extra spaces and line breaks (blank lines) will be ignored when the HTML is interpreted... so add them if you wish to do so.
Whatever falls between the TITLE tags will be the title of the document, when the page is viewed it is usually found in the title bar at the top of the screen. (On Windows Machines, this is to the left of the maximize/minimize buttons at the very top of the window.)
[Note: You may NOT use other tags within the TITLE tags (Example: You cannot have the code read: <title><b>title goes here</b></title>.]
Example of how titles are viewed...
In Microsoft Internet Explorer...

Whatever you place between the BODY tags will fall into the major area of the document window, and therefore it is the largest part of your HTML document.
Headings
Headings are some of the most important tags within the BODY of your HTML document. You will usually use a heading to tell what the following section of your page is about. The opening tag for a heading is < hy > and the closing tag is < / hy > with y being the size of the heading... from 1 to 6. (1 being largest, and 6 being smallest)
Example of heading tags...
Bob fell over the chicken. [H1]
Bob fell over the chicken. [H1]
Bob fell over the chicken. [H2]
Bob fell over the chicken. [H2]
Bob fell over the chicken. [H3]
Bob fell over the chicken. [H3]
Bob fell over the chicken. [H4]
Bob fell over the chicken. [H4]
Bob fell over the chicken. [H5]
Bob fell over the chicken. [H5]
Bob fell over the chicken. [H6]
Bob fell over the chicken. [H6]
Horizontal Lines
Horizontal Ruled Lines are used to separate different areas of a web page. The tag for a horizontal ruled line is < hr >.
The horizontal ruled line DOES NOT have a closing tag. You may also add certain attributes to the < hr > tag, such as width=n (for fixed pixel width) or width=n% for a certain percentage of the screen wide, size=n to make the line a certain pixel amount thick, and noshade to turn the line's shading off. A plain < hr > with no attributes will make the line the full width of the screen.
Example of horizontal ruled lines...
< hr width=50 >
< hr width=50% >
< hr size=7 >
< hr noshade >You may also use several attributes within one tag...
< hr width=50% size=10 noshade >
Paragraphs
You will often use paragraphs in HTML, just as you do when you write stories. The opening tag for a paragraph is <p>, and the closing tag is </p>. The closing tag for a paragraph is not always needed, but I recommend using it anyway.
Example of a paragraph...
Bob starts to chase the chicken around. Bob trips over a string and goes flying into the pig's mud pit! eww! What a pity!
<p>Bob starts to chase the chicken around. Bob trips over a string and goes flying into the pig's mud pit! eww! What a pity!</p>
Formatting Text
If you had an entire web page without formatted text, it would look rather dull and boring. This is why we use text formatting tags. Some common text formatting tags are and for bold, and for italics, and for underlined, and and for typewriter. The and tags also come in handy.
Example of font tags...
Bob is a Cool Guy isn't he?
<font size=+1>Bob</font> <font size=+2>is</font> <font size=+3>a</font> <font size=+2>Cool</font> <font size=+1>Guy</font> isn't <font size=-1>he?</font>
Lining Things Up
Many tags support ALIGN attributes... if you want something to be aligned from the left margin, from the center, or from the right margin. The ALIGN attribute is placed in the opening tag before the >.
Left Align
<h1 align=left>Left Align</h1>
Center Align
<h1 align=center>Center Align</h1>
Right Align
<h1 align=right>Right Align</h1>
Line Breaks
When your HTML document is viewed, normally the text will do a word-wrap at the end of a line. If you want to have the text BREAK (go to another line) you will use the
tag. This tag has no closing tag.
Example WITHOUT line Break...
Sentence One. Sentence Two. Sentence Three.
Sentence One. Sentence Two. Sentence Three.
Example WITH line Break...
Sentence One.
Sentence Two.
Sentence Three.
Sentence One.
Sentence Two.
Sentence Three.
Preformatted Text
If you wish to have text line up properly (a.k.a. fixed width text) that will include line breaks without the use of the <br> you may find the <pre> and </pre> tags helpful.
Example of text WITHOUT preformatting...
Output:
The cat ran after the dog.
^ ^-verb ^noun
^-noun
Code:
The cat ran after the dog.
^ ^-verb ^noun
^-noun
HTML ignores the extra line breaks, so the text does not line up properly.
Example of text WITH preformatting...
Output:
The cat ran after the dog.
^ ^-verb ^noun
^-noun
Code:
<pre>
The cat ran after the dog.
^ ^-verb ^noun
^-noun
</pre>
Now You Go Try!
That should be a good start for you.
Get some free space out on the web and set up your own web site (you can check out our links for free space).
Knowing this also helps in editing some of those free templates you get and want to tweak to make your own!