Section 8. Add a Title and Head

8. Add a Title and Head

BEFORE YOU BEGIN

2 Use HTML Tags

7 Set Up a Web Page's Basic HTML Structure


SEE ALSO

6 About Proper HTML Coding


Now that you have a basic structure filled in, it's time to start building out your page. Let's start with the head.

8. Add a Title and Head


For a simple HTML page, there are only a few things you need to add:

  • Metatags , which will contain information about the document, such as keywords that describe it. With keywords, the page will be more accurately indexed by search sites such as Google, and so your page will more easily be found by people.

  • The title , which will appear in the title bar of the browser.

  • Comments that you might want to appear in the head.

The only one of these three things that you have to add is the title, by the way. So if you don't want to add comments or metatags, you can ignore that.

1.
Add the Title

Nothing could be simpler than adding a title. Just enclose it between <TITLE> and </TITLE> tags, like this:

<TITLE>Why I Love Anna Karenina</TITLE>

NOTE

It's a bad idea to use colons or backslashes in your page's title. Some operating systems don't allow them to be used, and so you'll cause trouble if you try to use them. And if you need to use a special character in a title, such as a foreign letter, you'll have to use number or name codes for them.

Because titles are only displayed in the title bar of the browser, you may well be tempted to simply type in the first thing that comes to mind for a title, such as Welcome to my First Web Page . Resist that, at all costs. The title is much more important than you realize. When a search engine indexes your site, the first thing it looks at is the title. So a good descriptive title will make it more likely that your page will be found by people using search engines. And if someone bookmarks your page, the title is what appears in that person's Bookmarks or Favorites menu.

2.
Add Metatags

Now that you have a title, it's time to add metatags. There are many different uses for metatags, but for the website you're designing, the most important is to provide information about your site to search engines. The more information you provide to them, the more likely your site can be found on them, and the more visitors will come your way. And because you're building a site that you'd like the world to see, more visitors is better than fewer.

Keep in mind that you're not required to add metatags. Whether you want to is thoroughly up to you.

Metatags don't use closing tags, and can use many different attributes and values. In fact, anyone can make up their own attributes for them. No matter what metatags you use, they won't affect the way the page is displayed, because information in them is hidden.

The attribute you need to know about is the NAME attribute, because that's the one that describes the content of your site. Let's say that you want search engines to know that you're the creator of the website. Here's how you'd use the metatag and the NAME and CONTENT attributes ( assuming that your name is Preston Gralla, that is):

<META NAME="author" CONTENT="Preston Gralla">

In it, we're defining the author of the document as Preston Gralla.

Search engines commonly look for several different metatags. Here are the other important ones, and how they're used.

Description

This enables you to add a description of your website that offers more information than the title. It's particularly useful if you have a web page without a great deal of text. Some search engines will take your description and display it on the search results pages. Here's how you use it:

<META NAME="description" CONTENT="All the reasons why Anna Karenina is a great novel .">

Keywords

This lets you add descriptive keywords that are useful in helping index your page and determining what category of page it is. And it will help people find your page if they happen to type in one of the keywords you've entered. You separate the keywords by commas. Here's how you use it:

<META NAME="keywords" CONTENT="Russian novel, Tolstoy, Anna Karenina, literature"

3.
Add Comments

Adding a comment is as simple as it gets. Simply enclose your comments inside the comment tag. Note that the comment tag doesn't take a closing tag. Here's how to do it:

<! -- I last updated this page on February 15 2005 -- >

4.
View Your Page

If you haven't already saved the page, save it now. View it in your browser. If you've done your coding correctly, the browser will actually be blank at this point, except for the title bar. So why view it now? To make sure that you haven't made a coding error. You'll notice a coding error if anything displays in the browser. You also want to proofread the title as well.



Sams Teach Yourself Creating Web Pages All in One
Sams Teach Yourself Creating Web Pages All in One
ISBN: 0672326906
EAN: 2147483647
Year: 2006
Pages: 276

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net