+ 6
What is the difference (or connection) between "tag" and "element" in HTML?
While this two terms are usually used interchangeably, I don't think they are really the same thing. What is your view / understanding...? #want-to-know! ^-^
5 Réponses
+ 14
Tag - Your Name
Element - Yourself
+ 3
HTML tag is the opening and closing entity. For example:
<h1></h1>
Where as elements are something that consists of start tag and end tag, as shown below:
<h1>Heading</h1>
For more information, please read here: https://stackoverflow.com/a/8937454
+ 3
@Krishna, do you mean the element is the "whole thing" (content + tag) while the tag is the "semantic interface" of the content...?
^-^
+ 2
An element is an object, a tag is a class of object.
In javascript the difference becomes very clear:
getElementsByTagName("div") <--- that expression retrieves all the *elements* that are of a certain kind.
tag: human
elements:
^-^ Famyk ^-^
John Waters
....
Get it? Elements are individuals, tags are a reference of a group/kind that may or not contain any individuals.
+ 2
"do you mean the element is the "whole thing" (content + tag) while the tag is the "semantic interface" of the content...?"
Yes.
Opening tag: <div>
Closing tag: </div>
Element: <div>hello [may include child elements]</div>