Basic HTML: Lesson 2
Flags

Use these to jump around or read it all...

[HTML Flags][Flag Formats][Open and Close Flags][Single Flags][Writing Your First Page]

Hello and welcome to day two. No doubt you've attempted to write a small document on your word processor and save it as TEXT for MAC or ASCII TEXT DOS or TEXT for IBM. You also remembered to save the document with the .htm or .html suffix I'm sure. Good, now let's move on to today's lesson, for today we write!


HTML Flags

HTML works in a very simple, very logical, format. It reads like you do, top to bottom, left to right. That's important to remember. HTML is written with TEXT, English TEXT. What you use to set all this text apart as bigger text, smaller text, bold text, underlined text, is a series of flags.

Think of flags as commands. Let's say you want a line of text to be bold. You will put a flag at the exact point you want the bold lettering to start and another flag where you want the bold lettering to stop. If you want just a word to be italic, you will place a start italic flag and the beginning of the word and an end italic flag at the end of the word. Is this making sense so far?

Flag Format

All flag (or command) formats are the same. They begin with a less-than sign: < and end with a greater-than sign: >. Always--no exceptions. What goes inside the <> is the command. Learning HTML is learning the code to perform whatever command you want to do. Here's an example:

The code for bold lettering is "B". That makes sense.

Here's what the commands look like to turn the word "Carol" bold:

<B>Carol</B>

 

Look At What Is Happening

1. <B> is the beginning bold flag.
2. "Joe" is the word being affected by the <B> flag.
3. </B> is the end bold flag. Notice it is exactly the same as the beginning flag except there is a slash in front of the command.
4. This is what the bold flags above produced: Joe Nice, huh?

 

Some Questions

Q. Is the end flag for other commands simply the begin flag with the added slash?
A. Yes.

Q. Will the flags show up on my page?
A. No. As long as your commands are inside the <> marks, they perform the command, but are hidden from the viewer.

Q. Your bold flag uses a capital "B". Do all HTML Flags use a capital letter?
A. The browser doesn't care. In terms of flags, capitals and lower case letters are equal. But it will be a very good idea for you to make a habit of writing your flags in capital letters as it sets them apart from the normal text and makes them easier to pick out.

Q. Must everything have a flag to show up on the page?
A. No. If you just type in text, it will show up. But it will not have any special look.

Q. What if I forget to add the end flag or forget to add the slash to the end flag command?
A. That's trouble--but easy to fix trouble. It will be obvious if you've not placed an end flag when you look at the document in your browser. The entire document will be affected after where you forgot the end flag.

Q. Do all HTML flags require both a begin and end command like above?
A. No. There are exceptions to the rule.


Open and Close Flags

The majority of HTML flags do require both an open and a close flag (a begin and end flag). Most are very easy to understand. Here are a few and what they do to text:

Affect

Code

Code Being Used

What it does

BOLD

B

<B>Bold</B>

Bold

Italic

I

<I>Italic</I>

Italic

Typewriter

TT

<TT>Typewriter</TT>

Typewriter

Can I Use Two Flags at Once?

Yes. Just make sure to begin and end both. Like so:

<B><I>Bold and Italic</B></I> gives you Bold and Italic

<B><TT>Typewriter and Bold</B></TT> gives you Typewriter and Bold


Single Flags

The open and close flags format dominates the majority of the available HTML flags, but there are flags that stand alone. Here are three that are used extensively:

Flag

What It Does

<HR>

This command gives you a line across the page. (HR stands for Horizontal Reference) The line right above the words "Single Flags" was made using an <HR> flag.

<BR>

This BReaks the text and starts it again on the next line. Remember you saved your document as TEXT so where you hit ENTER to jump to the next line was not saved. So in an HTML document, you need to denote where you want every carriage return with a <BR>.

<P>

This stands for Paragraph. It does the exact same thing as the <BR> above except this flag skips a line. BR just jumps to the next line. "P" skips a line before starting the text again.


Writing Your First Page

So here we go...you're going to write your first HTML page using what you have learned above plus two other items. And these two items are important to every page you will ever write. Why? Because they will be on every page you ever write.

You will start every page with this: <HTML>
That makes sense. You are denoting that this is an HTML document.

Your next command will always be this: <TITLE> and </TITLE>
See the very top of this page? It reads "Basic HTML: Primer #2--Flags." It's in the blue line way up top. That's the title of the page and that's what you are denoting here.

Finally, you will end every page you write with this: </HTML>
You started the page with HTML and you will end the page with /HTML.

 

So Here We Go!

Play around with these commands. Just remember that HTML reads like you do, top to bottom, left to right. It will respond where you place the start command and stop where you place the end command. Just make sure your commands are within < and >.

Here's a sample page to show you what I mean for you to do tonight:


<HTML>

<TITLE> My first html page </TITLE>

<B>This is my first HTML page!</B><P>

I can write in <I>Italic</I> or <B>Bold</B><BR>

<HR>

<B><I>Or I can write in both</I></B><BR>

<HR>

<TT>...and that's all</TT>

</HTML>


Here is what the above will look like run through a browser:

 

 

 

This is my first HTML page!                          

I can write in Italic or Bold


Or I can write in both


...and that's all

 

 

 

 

Look at the program above and then what it produced. See how the HTML flags denoted where text was affected? Go now and practice creating your own pages. Follow the instructions in Lesson #1 to help you save and then display your first HTML page. You Can Do This!

Back to lesson two