What is the difference between HTML tags and elements?

I notice that most people use the words HTML tags and HTML elements interchangeably.

But what is the difference between the two?

As I can see, the tags are in the source code, and the elements are processed by tags (browser) in the DOM. I'm wrong?

+51
html terminology
Jan 20 2018-12-12T00:
source share
9 answers

An HTML tag is simply opening or closing an object. For example:

<p> and </p> are called HTML tags

The HTML element includes an open tag, a closing tag, content (optional for tags without content) For example:

<p>This is the content</p> : this complete thing is called an HTML element

+83
Jan 20 '12 at 6:13
source share
— -

HTML tags versus elements and attributes

HTML elements

An element in HTML represents some structure or semantics and usually consists of a start tag, content, and an end tag. Below is a paragraph element:

 <p> This is the content of the paragraph element. </p> 

HTML tags

Tags are used to indicate the beginning and end of an HTML element.

 <p></p> 

HTML attributes

An attribute defines a property for an element, consists of an attribute / value pair and appears at the beginning of the element tag. The element start tag can contain any number of attribute / value pairs separated by a space.

The most common abuse of the term "tag" refers to alt attributes as "alt tags". There is no such thing in HTML. Alt is an attribute, not a tag.

 <img src="foobar.gif" alt="A foo can be balanced on a bar by placing its fubar on the bar foobar."> 

Source: 456bereastreet.com: HTML tags against elements and attributes

+18
Jan 19 '14 at 10:41
source share

HTML elements

An HTML element usually consists of a start tag and an end tag with content inserted between:

 <tagname>Content goes here...</tagname> 

The HTML element is everything from the start tag to the end tag. Source

HTML Attributes

The attribute is used to determine the characteristics of the HTML element and is placed inside the element’s open tag. All attributes consist of two parts: name and value .

  • All HTML elements can have attributes.
  • Attributes provide additional information about an item.
  • Attributes are always specified in the start tag.
  • Attributes usually come in name / value pairs, for example: name = "value" Source

HTML tag vs element

"Elements" and "tags" are terms that are widely confused. HTML documents contain tags but no elements. Elements are generated only after the parsing step, from these tags. Source: wikipedia> HTML_element

The HTML element is determined by the start tag. If the element contains other content, it ends with a closing tag.

For example, <p> is the start tag of a paragraph, and </p> closes the tag of the same paragraph, but <p>This is paragraph</p> is a paragraph element.

Source: tutorialspoint> html_elements

+5
Mar 21 '17 at 20:29
source share

lets make it a simple term. An element is a set of opening and closing tags.

+4
Jan 23 '14 at 10:35
source share

http://html.net/tutorials/html/lesson3.php

Tags are tags that you use to indicate the beginning and end of an element.

All tags have the same format: they begin with a character less than "<" and end with a ">".

Generally speaking, there are two types of tags - opening tags: <html> and closing tags: </html> . The only difference between the opening tag and the closing tag is the slash "/". You place content by placing it between the opening tag and the closing tag.

HTML is all elements. To learn HTML, you need to learn and use different tags.

For example:

 <h1></h1> 

Where as elements there is something that consists of a start tag and an end tag, as shown:

 <h1>Heading</h1> 
+3
Jan 20 '12 at 7:11
source share

Tags and Elements do not match.

Items




These are the parts themselves, i.e. a paragraph is an element, or a heading is an element, even a body is an element. Most elements can contain other elements, since the body element will contain heading elements, paragraph elements, in fact almost all visible DOM elements.

For example:

 <p>This is the <span>Home</span> page</p> 

Tags




Tags are not elements themselves, rather they are bits of text that you use to tell the computer where the element starts and ends. When you “tag” a document, you usually do not need these additional notes, which are not really part of the text that should be presented to the reader. HTML borrows technology from another SGML language to provide an easy way for a computer to determine which parts are “MarkUp” and which parts are content. Using '<' and '>' in brackets, HTML can indicate the beginning and end of the tag, that is, the presence of '<' tells the browser, "this next bit is markup, note."

The browser sees the letters "

"and decides:" A new paragraph has begun, it is better to start a new line and, possibly, back off. "Then, when he sees"

"he knows that the paragraph he was working on is over, so he must break the line there before moving on to the next.

- Opening a tag.

- End tag enter image description here
+1
Feb 14 '17 at 19:29
source share

This visualization can help us know the difference between the concept of an element and a tag (each of them contains an indent):

 - element - content: - text - other elements - or empty - and its markup - tags (start or end tag) - element name - angle brackets < > - or attributes (just for start tag) - or slash / 
0
Nov 12 '17 at 5:43 on
source share

HTML elements

An element in HTML represents some structure or semantics and usually consists of a start tag, content, and an end tag. Below is a paragraph element:

 <p> This is the content of the paragraph element. </p> 

HTML tags

Tags are used to indicate the beginning and end of an HTML element.

The start tag consists of an opening angle bracket (<), followed by the name of the element, a pair of attribute / value pairs with zero or more space, and a closing angle bracket (>).

Starting tag without attributes:

 <p> 

Start tag with attribute:

 <p class="info"> 

End tags consist of an opening angle bracket followed by a slash, an element name, and a closing angle bracket:

 </p> 

for full details (link) https://www.456bereastreet.com/archive/200508/html_tags_vs_elements_vs_attributes/

0
Nov 30 '18 at 19:40
source share
 <p>Here is a quote from WWF website:</p>. 

There is a tag in this part of <p> .

 <blockquote cite="www.facebook.com">facebook is the world largest socialsite..</blockquote> 

in this part <blockquote> is an element.

-one
Sep 06 '15 at 19:36
source share



All Articles