HTML elements are not tags!
I admit I didn’t use the terminology right from the start when I first got introduced to HTML. But then again, I wasn’t blogging about it and teaching it to people. Today I noticed someone just doing that. A popular blog teaches some basic HTML but uses terminology wrong. Unfortunately, because the blog seems to be rather popular a lot of people will also confuse elements with tags.
Let me quote what this blogger wrote under the heading “What are HTML tags?”:
The end ones usually have a slash (/) in them which differentiates them from the opening ones and signals to your browser that it is the end. So they will usually have this basic format - < > </ >.
Come back to this example after you read the rest and you’ll be able to tell what’s wrong with it.
First I’ll repeat the title of this post: HTML elements are not tags!
An element typically consists of a start and end tag, with content in between. For example:
<p> HTML elements are not tags</p>
is a paragraph element, with a start tag “<p>”, an end tag “</p>” and content in between them.
Some elements do not have content in them, and we write them using a special tag format with a “/”. For example:
<br />
A start tag can also have some property definition in it. These are the attributes. A commonly used one is the alt attribute:
<img src=”http://www.example.com/image.jpg” alt=”an example image” />
Using these terms correctly often makes things easier. You know what the author is speaking about and there is no confusion. Now look back at the quote. Can you tell what’s wrong with it now?