HTML element: Difference between revisions

Content deleted Content added
Chira (talk | contribs)
No edit summary
Wapcaplet (talk | contribs)
m rephrase WP:HEP directive, removed cleanup tag
Line 1:
''This article is about [[HTML]] elements. For information on how to format [[Wikipedia]] entries, see [[Wikipedia:How to edit a page]].''
{{cleanup}}
 
<small>This article is about HTML in general. Look [[WP:HEP|elsewhere]] to learn about formatting wikipedia entries.</small>
----
 
In [[computing]], an '''HTML element''' (instance) in terms of [[SGML]] is the complete sequence of a start ''tag'' (with [[attribute]]s and their [[attribute value|value]]s), any embedded HTML content, and the end tag. A special case is [[empty element]]s that don't have contents and end tags. Due to the constraints of the [[Document Type Definition|DTD]]s, various parts, including start and end tag, may be omitted in [[HTML]], but not [[XHTML]]. In XHTML the minimized tag syntax for an empty element (abbreviated form of the combination of opening and closing tag) is e.g. <code>&lt;br /></code>.
Line 6 ⟶ 7:
Informally, HTML elements or their attributes are often simply called "tags" (an example of [[synecdoche]]), though many prefer the term ''tag'' strictly in reference to the semantic structures delimiting the start and end of an element.
 
=="Nesting"==
 
Most but not allMany HTML elements can be "nested": <code>&lt;p>&lt;em>You&lt;/em>rock!&lt;/p></code> has an <code>em</code> element nested inside a <code>p</code> element. This can become more complex, for example <code>&lt;h1>Children that &lt;em>do &lt;font color="red">not&lt;/font> clean up&lt;/em> their rooms&lt;/h1></code>. Nesting may be arbitrarily deep. Tags must be closed in the reverse order that they've been opened.
 
;Wrong: