Blog-Support

Tag Basics

posted Sunday, 1 April 2007

The HTML world is built around the notion of tags. A tag is a special string that denotes some special processing the browser must do. For example a tag could instruct the browser to bold a particular set of words, or insert an image at a particular point. Tags are described using the special characters < and >. There are many tags defined in the HTML language for defining a whole series of different presentation actions.

HTML tags are invisible to the final rendered page; they are instructions to the browser to do special formatting.

Basic HTML tag: Opening and closing tags

The most basic HTML tag is one that has no attributes associated with it. For example, consider the bold tag shown in the box beside. The opening the tag instructs the browser to start bolding the text upto the point it reads the end tag which stops the bolding formatting.

HTML tag with attributes

Another form of tag is one that has parameters or attributes associated with it. For example the tag that instructs the browser to create a link to another page is theA (anchor) tag. An example of this tag, can seen in the box above.

As we can see the basic makeup of this tag is very similar to the basic tag, except this time we have an extra HREF part to the opening tag. This instructs the browser which address to use when a user clicks on the link. This extra piece is called the tag parameter or attribute. This is formatted in a special way with no spaces in around the = sign, and the data of the attribute appearing in double quotes (" "). Failure to adhere to this formatting will cause parsing errors on your web page.

Special Characters

A classic question:

"So if every time the browser sees a < character and it assumes it's the start of the tag, how do I actually include the < in my page and not have it rendered as a tag?"

A HTML conundrum! All is not lost. The away round this is not to actually type the < but instead, insert a special code (or escape sequence) for the characters that may be interpreted as a tag. In this instance we replace < with &lt; and > with &gt;.

That may seem logical enough, but while it solves one problem it does create another one; how do we then write & sign if the browser will interpret these as a special escape sequence? Easy; we have an escape sequence for the & which is &amp;.

There are a number of these special characters that should really be escaped. You can see a complete list of them here.

Hints'n'Tips

Tag names can be expressed in either upper or lower case. The browser does not care.

It is important you do not put any spaces in the tag name. < B> is illegal for example.

Tag attributes do not need to appear in one line; they can be placed on different lines as long as the individuate key=data pair is kept on the same line.

The closing tag is always the same name as the opening tag; but prefixed with a slash (/)
Closing tags never contain any attributes.
All tags should have a closing tag; some do not. It is safe to always specify one.

tags:        



Need One-to-One Help?
If you are in any doubt, contact support

Related Posts

Tag Basics

More about HTML tags including anchors and special characters

First HTML Page

Beginners HTML

Inserting mp3s or music files.

Ever thought of inserting your favorite song as an mp3 or other audio file in to your blog? Here are the instructions on how to do so.

How to add a Flash animation

Instructions on how to add a Flash animation to a blog entry, header, or custom portlet.

How do I put HTML into my blog entry?

If you are using the advanced editor, then you need to make sure you are in HTML mode before you add in HTML, do this by clicking the "html" button along the top.

Inserting images using HTML

Instructions and examples on how to insert an image using HTML. This can be used in the Basic Editor, widgets, headers, and any other fields where you can input HTML.

Paragraphs and Line breaks in HTML

How to work with paragraphs and linebreaks in HTML.

HTML Special Characters

If you need to know how to add special characters to your blog, this is your ticket!

HTML Color Reference

Hex Color codes explained.

Basic HTML

Although you can use the advanced editor some people prefer to go with the basic one. This can be tricky if you don't know much HTML. Well here we will tell you some basic HTML you can use. From making a word bold to adding images.