Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 771421 of Element

  • Revision slug: Glossary/Element
  • Revision title: Element
  • Revision id: 771421
  • Created:
  • Creator: Andrew_Pfeiffer
  • Is current revision? No
  • Comment

Revision Content

An element is a part of a webpage. In XML and HTML, an element might contain a data item or a chunk of text or an image. A typical element includes an opening {{glossary("tag")}}, {{glossary("attribute","attributes")}}, content and a closing tag:

Example: in <p class="nice">Hello world!</p>, '<p class="nice">' is an opening tag, 'class="nice"' is an attribute and its value, 'Hello world!' is enclosed text content, and '</p>' is a closing tag.

Element and tag are not interchangeable: tags begin or end an element in the source, whereas elements are part of the {{Glossary("DOM")}}, the document model for displaying the page in the {{glossary("browser")}}.

See also

Revision Source

<p>An <strong>element</strong> is a part of a webpage. In <a class="glossaryLink" href="https://developer.mozilla.org/en-US/docs/Glossary/XML" title="XML: XML stands for Extensible Markup Language. It is different and in some ways better than HTML which stands for HyperText Markup Language.">XML</a> and <a class="glossaryLink" href="https://developer.mozilla.org/en-US/docs/Glossary/HTML" title="HTML: The HyperText Markup Language (HTML) is a descriptive language specifically designed to structure web pages.">HTML</a>, an element might contain a data item or a chunk of text or an image. A typical element includes an opening {{glossary("tag")}}, {{glossary("attribute","attributes")}}, content and a closing tag:</p>

<p><img alt="Example: in &lt;p class=&quot;nice&quot;&gt;Hello world!&lt;/p&gt;, '&lt;p class=&quot;nice&quot;&gt;' is an opening tag, 'class=&quot;nice&quot;' is an attribute and its value, 'Hello world!' is enclosed text content, and '&lt;/p&gt;' is a closing tag." src="https://mdn.mozillademos.org/files/7659/anatomy-of-an-html-element.png" style="width: 609px; height: 181px;" /></p>

<p>Element and tag are <em>not&nbsp;</em>interchangeable: tags begin or end an element in the source, whereas elements are part of&nbsp;the {{Glossary("DOM")}}, the document model for displaying the page&nbsp;in the {{glossary("browser")}}.</p>

<h2 id="See_also">See also</h2>

<ul>
 <li>The {{domxref("Element")}} interface, representing an element in the DOM.</li>
 <li><a href="/en-US/docs/Web/Guide/HTML/Element">More details about elements.</a></li>
</ul>
Revert to this revision