Reputation: 28148
What is the difference between an HTML Element and an HTML Tag ? Is there any difference with rendering ? Any there special considerations when using a tag or an element ?
Upvotes: 2
Views: 581
Reputation: 98786
<p>
is a tag, specifically an opening tag</p>
is also a tag, a closing tag<p>This is a paragraph</p>
is an element — opening tag, closing tag, and contentsGenerally when you’re talking about HTML, it doesn’t really matter which term you use, but if we’re getting technical, the above points illustrate it.
Unless I’m missing something, you can’t use an element without using a tag (because elements are made from at least one tag), and whenever you use a tag, you’ve got an element.
Upvotes: 8
Reputation: 579
Unless you mean the HTML tag <html></html>
which tells the browser this is an HTML document and HTML elements which are everything else as already mentioned.
Upvotes: 1
Reputation: 887215
Element
and Tag
are two terms that generally refer to the same thing.
When programming against HTML, however, Tag
usually refers to a string (eg, "<b>...</b>
), whereas Element
refers to a DOM object representing a tag.
Upvotes: 8