Meta Tags
Meta tags, which are always
located in the head portion of your HTML document, are used to communicate
information about your webpage that a human visitor would probably not be
interested in. For example, meta tags can tell a browser what "character set" to
use or the parental rating of the webpage. The content contained in the meta
tags is only visible to web browsers and does not effect the look or content of
your webpage.
Keywords and Descriptions
Keyword and description meta tags are
used to describe the content of your webpage. Each of these meta tags has two
attributes, name, which indicates what type of meta tag it is, and content,
which contains the type of information indicated by the name attribute. To
include a keyword meta tag, set name equal to keyword, and set content equal to
a list of keywords that describe the content of your webpage.
| <meta name="keywords" content="Meta Tags, Comments, Validation"> |
To include a description meta tag, set name equal to description, and set content equal to a short paragraph that describes the content of your webpage.
| <meta name="description" content="How to use meta tags and comments in an HTML document. Also describes W3C validation."> |
Some search engines use the keywords meta tag to identify the document in a search and then display the description contained in the description meta tag with the document title.
Parental Controls
The Platform for Internet Content Selection
(PICS) is an infrastructure for associating labels with Internet content.
Originally designed to help parents and teachers control what children can
access on the Internet, it also facilitates other uses for labels, including
code signing, privacy, and intellectual property rights management.
| <META http-equiv="PICS-Label" content=' (PICS-1.1 "http://www.gcf.org/v2.5" labels on "1994.11.05T08:15-0500" until "1995.12.31T23:59-0000" for "http://w3.org/PICS/Overview.html" ratings (suds 0.5 density 0 color/hue 1)) '> |
You can generate your own PIC label at the ICRA: Internet Content Rating Association
Webpage.
You can also find much more information about PIC's from http://www.w3c.org/PICS/.
Page Author
This meta tag identifies the author of the webpage.
| <meta name="author" content="Maggie Basque"> |
Caching
You can use meta tags to tell the browser not to cache the
page. This allows for the newest version of the page to be displayed in the
browser. This will slow down the download speed of the page and should only be
used on a page that is frequently updated.
Note: Some browsers may ignore
this command.
| <meta http-equiv="pragma" content="no-cache"> |
Comments
Comments allow you to put
information in your HTML code that is hidden from the web browser. In other
words, no one can see your comments unless they look at your HTML code. To add a
comment, use <!-- to begin the comment and --> to end the comment.
Comments can be several lines long if necessary. Here is an example:
| <!-- This is an example of a comment --> |
Comments can be useful in a few different situations. If you use code that you found on another website, you should put a comment before that code crediting the site you took the code from. If you do not add a comment, you have taken another person's work and are passing it off as your own, which is plagiarism.
| <!-- The following JavaScript code was copied from http://www.js-examples.com/js --> |
It is also useful to include comments in your code as notes to yourself. If you intend to add more code to a certain part of your page, or find and insert a picture later on, you can use comments to remind yourself what you wanted to do.
| <!-- Insert a picture of a computer here --> |
You can also use comments to ignore a part of your code that isn't working. You can then work on other parts of your webpage and go back and fix the problematic code later.
The HTML standard is maintained by the World Wide Web Consortium (W3C - http://www.w3c.org/). They provide a free validation service that will tell you if your page conforms to the HTML standard. Validating is important to help ensure that your page will render correctly in all browsers. Passing W3C validation does not ensure that your page will always render correctly, partly because not all browsers conform to the exact standard at this time. However, validating your page is usually helpful and a good step towards achieving good discipline in web page creation.
Validating your HTML code
To work with the W3C validation service,
you must add a tag at the beginning of your HTML code to specify what version of
the HTML standard you are using. HTML 4.01 Transitional is currently the best
one to use. You also need to specify the content type of your HTML code, which
you will do using a meta tag.
To use the validation service, the first four
lines of your HTML document should be:
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
Following these four lines of code, you can include other header tags, such
as other meta tags and a title tag. Don't forget to close the header with
</head>.
Once you have added the necessary tags, you can try to
validate your HTML code. The W3C validation service can be accessed at http://validator.w3.org/. You can choose to
validate a page by URL (internet address), or by file upload (use this option if
the file is stored on your computer or on a disk.
If your code is valid, you should see a screen that looks
something like this:
Congratulations, your code is valid HTML. If your code is not
valid, you will see a screen that looks like this:
After the red bar which tells you that the page is not
valid HTML, there will be a list of errors with explanations on what the errors
might be and how to fix them. Once you have changed your HTML code, you hit the
refresh button to revalidate your page.