Add Links to a Web Page with HTML

Links or hyperlinks are those little underlined words on a web page that you click to go to another location.

Hyperlinks are created using the anchor tag.

The anchor tag in its most basic form looks like this: <a></a>

When the anchor tag is used as a hyperlink it looks like this:
<a href=""></a>

The name of the page your are going to is placed between the quotation marks. A short description or visible page name is placed between the tags.

If we were going to page 2 it might look like this:
<a href="page2.html">Page 2</a>

You can also place pictures or images between the tags to create buttons on your web page.

We've supplied three buttons for our demo site. The 3 pages we'll create for the site are index.html, about.html and friends.html.

The Home page of your website should always be named index.html. This is by default the page that will open on your website when someone types your URL or domain name into a browser.

Here is what the code looks like with our 3 anchor tags and button images.
<br>
<p id="links">
<a href="index.html"><img src="images/home.gif"></a><br>
<a href="about.html"><img src="images/about.gif"></a><br>
<a href="friends.html"><img src="images/friends.gif"></a></p>
<br>

Notice that we set the anchor tags in a paragraph and gave the paragraph an id. We'll use the id links to correct some problems later.

Notice also the line break tag which is used to break the lines of code and add space. The line break tag looks like this: <br>

This block of code is going to be placed in the left cell under the code for the strawberry. The left cell will then look like this:
<table>
<tr>
<td id="left"><img src="images/strawberry.jpg">
<br>
<p id="links">
<a href="index.html"><img src="images/home.gif"></a><br>
<a href="about.html"><img src="images/about.gif"></a><br>
<a href="friends.html"><img src="images/friends.gif"></a></p>
<br>
</td>

Add the code and save the web page. If you look at the page in your browser you will see that the buttons are arranged to the left and indented, they also display a border.. Let's add the code to the style sheet that will fix the alignment and indent problem. Borders will come next.

When you add an id attribute to an element on a web page it is defined in the style sheet by preceeding it's name with a pound sign.

We named the paragraph that contains our link buttons links. Now we'll add 2 lines of code to the style sheet that will center the buttons and remove the text indent.
#links {
text-align: center;
text-indent: 0}

Copy the code and paste it into the style sheet. Save the changes.

Now open the web page in your browser or click the refresh button to see your link buttons centered under the strawberry. The border is still there.


Borders

Images as Links
Anytime you use an image as a link it will have a default border. You can add an attribute to the tag border="0" or for more concise code, use the border:none property in your style sheets.

Before we create our 3 pages let's add some borders and we're almost done with the template.

Borders can be added using our style sheet.

An example of the code is shown here: border: solid #660000 3px;

This simple statement adds a solid border, red in color and 3 pixels in width.

Other styles of borders that you can use are : dash, dotted, groove, inset and outset. all of these styles work in both IE and Mozilla browsers. there will be a slight difference in appearance between the two browsers.

We're going to add an inset border to the body tag. This will the page the appearance of being dished out. We could just add the code to the existing definition of the body tag in our style sheet. to make it easier on you we'll just add a separate statement.
body { border: inset #660000 4px }

Copy this line of code and paste it into the style sheet.

Save the style sheet and look at the web page in your browser. Refresh if needed.

Now we'll add an outset border to the images on the page to give them a raised appearance. this will cause a problem with our buttons and heading, but we'll soon learn the purpose of our id tags.

Here is the code to add the outset border:
img { border: outset #660000 3px }

Copy the code and paste it into the style sheet. Save the changes and look at your web page in the browser. Refresh if needed.

There you go. Borders around our strawberry and any pictures we put on the page. Unfortunately there are also borders around our heading image and still on our buttons.

Now we can see the power of style sheets and the use of the id attribute.

When we added the site heading we named the cell that it was located in heading. When we added the links we named the paragraph where they are located links.

We can turn off the image borders in both of these locations with this simple statement:
#heading img, #links img { border: none }

Notice the code addresses the image tag in both locations, #heading and #links.

copy the code and paste it into the style sheet. Save the Changes.

Open your web page in your browser. Refresh if needed. Voila!! No borders except where we want them.

That completes the body section of our template. Now we'll add some code to the head section and we'll be ready to create our pages.

Head Section

The head section and doctype tag of an HTML document contain information for browsers and search engines.

The head section is a very important part of your HTML page. The most important and the very first tag that should appear is the title tag.
The basic code is:
<title></title>

Your title tag is one of the major tags used by search engines to determine the position of your website. It should contain the major keyword phrases that you want your site to be found for when people search on the net.

Learn as much as you can about keywords and their use in web page content before you start adding text to your web pages.

Add the code for the title tag directly below the opening <head> section tag.

Directly below the title tag add the code for your meta tags. These tags are also used by search engines. The description should contain a brief description of the content of your web page. You should also place your keyword phrases in these tags.

Place your keyword phrases separated by commas in the keywords meta tag.

Here's the code for your meta tags:
<meta name="description" content="">
<meta name="keywords" content="">

When your head section is complete, save all changes and look at the page in your browser.

Code for head section:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta name="description" content="">
<meta name="keywords" content="">

<link rel="stylesheet" href="stylesheet.css" type="text/css">
</head>



Take a short quiz on the information you just learned.

That completes Phase I of this tutorial. I recommend that you delete all of your work and start over. Work through the lessons until you see the connection between the tags on your web page and the entries in your style sheet.

When you are comfortable Start Phase II


Free Business Web Hosting

If you are building a website for a business or organization, you can put it online for free at Microsoft® Office Live Small Business. You can create your website with HTML and upload it or use their tools and build it online. Take your business online with Microsoft® Office Live Small Business. Get started for FREE! Take the TOUR!

Create Web Sites without Learning Code

Create web sites online without learning any code using Yahoo's simple but powerful Site Solution builder.
Try the Site Solution Demo

Sitebuilder 2.6 is even better than previous versions of Yahoo's downloadable builder. Download it to your PC and create a web site with all the bells and whistles.

Start today and SAVE 25% on your first 3 months.

Get everything you need for a great web site with Yahoo! Web Hosting - 25% off





Add a Website Heading with HTML

Property of
Net Success 2000 Plus Inc
Po Box 1508
Somerset KY 42502
Last Modified: October 7, 2008

Start Phase II

Home

HTML Tutor
Beginner
HTML Basics
Add a Heading
Add a Paragraph

Intermediate
Phase I
Getting Started
Basic HTML Page
Creating Columns
CSS
Color
Headings
Images
Paragraphs
Site Heading
Linking

Advanced
Phase II
Start Phase II
Editing Pages
Change Appearance
Summary

Helps
Tag Glossary
Finished Code
Image Download
Color Tool
Hex Code Chart
Free Web Templates
Free Heading Graphic
Free Backgrounds
Put It on the Web
Quizzes
Your Questions

HTML Editors
Overview
NoteTab Light
Webbuilder

Online Builder Tutorials
Soholaunch
SiteReptile
SiteSTUDIO

Other Helps
Flash Web Sites