What is a HTML tag
If you have read any of the beginner tutorials you will probably know by know that HTML is a core part of any website. This page will supply you with the a list of the basic HTML tags, along with a brief explanation of each.
A HTML page consists of a bunch of tags which have a specific purpose. Always remember that these tags should be in a certain order, this keeps the page logical. Please refer to the web standards page to read more about this.
So what is a tag? A HTML tag is basically a code which can be interpreted by web browsers in a certain way. In other words, a tag tells a web browser what to do with the information provided inside the tag.
Basic HTML tags and structure
Below is a list of the main HTML tags needed to lay the structure of a website. Please note, they are listed in the order in which they should be used.
- <html> This opens the HTML document and should be at the top of the page. The only thing that should be above this is the doc type.
- <head> The head section should contain any information about the page, but not the actual content of the page itself. Things such as the title,instructions and links to such things as external style-sheets should go here.
- <title> Title of the web-page </title>
- </head> This closes the head section. Remember all tags need to be closed.
- <body> This is where the main content of the page belongs. Anything such as text, links and pictures belong here.
- <h1> Main header</h1> Stands for heading 1. This is the most important heading and should be used appropriately. Only use the H1 tag once per page. For further information on headings click here
- <p> Abbreviation, meaning paragraph .This is where your main text content belongs. All text content should be contained within some form of tag, whether it be a paragraph, heading, list item etc.
- <h2> - <h6> Headings 2 through to 6. These headings can be used multiple times on a single page. However they should remain in order. For example, you should not use a H3 heading and then use a H2 heading below it. All headings end using the normal closing tag. >/h2<
- </body> End of the main content section.
- </html> End of the html Document.
Remember, if you are using an opening tag such as <p> you will most likely need a closing tag also. The closing tag is always the same as the opening tag, but with a / in front. Like so, </p>.
There are some exceptions to this rule however, the img tag for example. Lets take a look at an img embedded in a HTML page:
<img src="image.gif" alt="this is an image"/>. If you think you have an error in your HTML code, or are unsure about using a closing tag save your page and run it through the w3c HTML validator..
That should pick up any errors and provide a solution to the problem