BASIC HTML TUTORIAL

 

Lesson Two
 

In Lesson One you used the basic tags to make a simple web page. In this lesson you will begin to assign attributes to tags. Attributes make the tags more specific. Many tags have several attributes to choose from - such as color, width, height, alignment, etc.

Lesson Two covers:

  • Changing the background color of a page.
  • Using an image as a page background.
  • Centering.
  • Making text bold.

Begin by opening the file page01.html that you created in Lesson One. It should look something like what you see below (the proper tag order). If not, then make it so before you continue.

<HTML>
<HEAD><TITLE>My First Web Page</TITLE></HEAD>
<BODY>
Everything I want to say on my page is right here.
</BODY>
</HTML>

That is the basic web page. Now you will edit it to spruce it up. Before you do, duplicate the page01.html file by using SAVE AS. (SAVE AS is usually listed under the drop down FILE menu.) Rename it to page02.html.

By using SAVE AS and renaming it, you preserve page01.html as it is. You should do this for each page for each consecutive lesson. Do this in case you make some major error or just want to go back a step.

Working with page02.html, change the TITLE text to My Second Web Page.

Section 1 - PAGE COLOR

The BODY tags open and close your page content. To change the background of the entire page you add an attribute to the opening <BODY> tag as follows:

<BODY BGCOLOR="#00FFFF">

What determines the color in that attribute is the value 00FFFF, which in this case would make the page light blue. To see how this value is determined, see Web Color Picker and Color Converter from the Main Menu.

If you do not specify a background color for your web page, the default may be grey or white. So just to be sure, it is a good idea to specify the background as white - unless of course you want some other color.

<BODY BGCOLOR="#FFFFFF"> makes it white.

Section 2 - PAGE BACKGROUND IMAGE

You are not limited to only background colors. Instead, you can tell the browser to use an image for the background. So, you need a background image for this lesson.

Go my example page02.htm by clicking here to get the image you will use for this tutorial. A new browser window will open. Simply close it when you are done with this lesson.

To use that image as the background on your page02.htm file, change the <BODY> tag to:

<BODY BACKGROUND="blueback.jpg">

The BGCOLOR and BACKGROUND attributes can also be used to change the color or background in specific parts of a web page which we will get to in the lesson on creating Tables.

Hopefully you noticed more than the background on my page02.htm sample page. If not go back and look. Some of the type is CENTERED at the top of the page, some of it is BOLD.

Section 3 - CENTER and BOLD

To center text (and other elements on your page) you surround it with the open and close CENTER tags, shown in this example:

<CENTER> text here </CENTER>

To make text bold, you surround it with the open and close BOLD tags:

<B> text here </B>

To make text centered and bold:

<CENTER><B> text here </B></CENTER>

or

<B><CENTER> text here </CENTER></B>

It is not a good idea to write the code like this

<CENTER><B> text here </CENTER></B>

because the closing tags are not in the reverse order - that is to say, you should close the most recently opened tag first. Otherwise your code may confuse some browsers.

In the above examples, I only used the words, text here but you can use these tags to center as much of your page as you want and you can make as much text as you want bold.

Section 4 - PARAGRAPH

You just need to know one more simple tag to be able to create my sample page for this lesson, and that is to put the paragraph tags <P> </P> around each of your sentences (and paragraph) so they start on a new line with paragraph space between them (more about this tag pair in another lesson).

You should now have learned how to create a page that looks like my sample page (page02.html) for this lesson. Click here to see it again, then try to create the code before going to another lesson.

Check to make sure you did it correctly, by clicking here to see my code.

 

 

 

Text, Photos, Graphics Copyright Small Expressions © All Rights Reserved.