Beginning HTML - Home
Introduction - What is HTML, What it can do, what you'll need, etc. The Basics - First steps in HTML. Moving On - Further concepts. Advanced - More advanced ways to use HTML. Glossary - Explanation of terms used in this site HTML Tag and attribute reference - look up the most popular tags and their common attributes for reference
Square The Basics
square What are tags?
Square Making a first page
Square Basic formatting
Square Fonts-color and size
Square Styling your text
Square Writing 'good' HTML
Square Adding comments
 
What are tags?
What are elements and attributes?

What are tags?

Tags, elements and attributes are the building blocks of HTML. Although they sound quite complicated, the principle is a very simple one.
A tag is an instruction to the browser that's displaying the page, and either means the start of an instruction or the end of it. The contents of a tag go inbetween angle-brackets - i.e. < and >. An example of a tag is -
<b>
- Which is the tag, or instruction, to display the subsequent content in a bold face. At the end of the bold content, the closing tag would be inserted, to tell the browser to stop displaying in bold -
</b>
The '/ signals the end of that instruction. Some tags don't need closing tags, but we'll cover those as we go.

What are elements and attributes?

Tags are made up of two parts - elements and attributes. To explain the principles, let's say there was a tshirt tag - <tshirt>. We might want to specify the color of the tshirt. So we would include a color attribute -
<tshirt color="red">
The element in this tag is tshirt. The attribute is color. Put together they make a tag. The contents of the attribute go between quote marks ("").
You can have more than one attribute in tag. Let's suppose we'd like to include the size of the tshirt as well, using the fictional size attribute. We might use code like -
<tshirt color="red" size="large">
Here's an example of a real HTML tag, with the element and attributes pointed out -
Demonstration of elements and attributes

Now that you know a little about how HTML works, let's move straight on to making a simple page...

TopTop of page - BackBack to The Basics - Next - A first pageNext

Introduction - The Basics - Moving On - Advanced - Glossary - Reference