An HTML element is a type of HTML (HyperText Markup Language) document component, one of several types of HTML nodes (there are also text nodes, comment nodes and others).
(February 2019)">vague] The first used version of HTML was written by Tim Berners-Lee in 1993 and there have since been many versions of HTML. The current de facto standard is governed by the industry group WHATWG and is known as the HTML Living Standard.
An HTML document is composed of a tree of simple HTML nodes, such as text nodes, and HTML elements, which add semantics and formatting to parts of document (e.g., make text bold, organize it into paragraphs, lists and tables, or embed hyperlinks and images). Each element can have HTML attributes specified. Elements can also have content, including other elements and text.
As is generally understood, the position of an element is indicated as spanning from a start tag and is terminated by an end tag. This is the case for many, but not all, elements within an HTML document. The distinction is explicitly emphasised in HTML 4.01 Specification:
Elements are not tags. Some people refer to elements as tags (e.g., "the P tag"). Remember that the element is one thing, and the tag (be it start or end tag) is another. For instance, the HEAD element is always present, even though both start and end HEAD tags may be missing in the markup.
Similarly the W3C Recommendation HTML 5.1 2nd Edition explicitly says:
Tags are used to delimit the start and end of elements in the markup. (...) The start and end tags of certain normal elements can be omitted, (...)
The contents of the element must be placed between just after the start tag (which might be implied, in certain cases) and just before the end tag (which again, might be implied, in certain cases).
and:
Certain tags can be omitted.
NOTE:
Omitting an element's start tag (...) does not mean the element is not present; it is implied, but it is still there. For example, an HTML document always has a root element, even if the string doesn't appear anywhere in the markup.
As HTML (before HTML5) is based on SGML, its parsing also depends on the Document Type Definition (DTD), specifically an HTML DTD (e.g. HTML 4.01). The DTD specifies which element types are possible (i.e. it defines the set of element types) and also the valid combinations in which they may appear in a document. It is part of general SGML behavior that, where only one valid structure is possible (per the DTD), its explicit statement in any given document is not generally required. As a simple example, the <p>
tag indicating the start of a paragraph element should be complemented by a p>
tag indicating its end. But since the DTD states that paragraph elements cannot be nested, an HTML document fragment <p>Para 1 <p>Para 2 <p>Para 3
is thus inferred to be equivalent to <p>Para 1 p><p>Para 2 p><p>Para 3
. (If one paragraph element cannot contain another, any currently open paragraph must be closed before starting another.) Because this implication is based on the combination of the DTD and the individual document, it is not usually possible to infer elements from document tags alone but only by using an SGML—or HTML—aware parser with knowledge of the DTD. HTML5 creates a similar result by defining what tags can be omitted.
SGML is complex, which has limited its widespread understanding and adoption. XML was developed as a simpler alternative. Although both can use the DTD to specify the supported elements and their permitted combinations as document structure, XML parsing is simpler. The relation from tags to elements is always that of parsing the actual tags included in the document, without the implied closures that are part of SGML.
HTML as used on the current web is likely to be either treated as XML, by being XHTML, or as HTML5; in either case the parsing of document tags into Document Object Model (DOM) elements is simplified compared to legacy HTML systems. Once the DOM of elements is obtained, behavior at higher levels of interface (example: screen rendering) is identical or nearly so.
%block;
vs. box Part of this CSS presentation behavior is the notion of the "box model". This is applied to those elements that CSS considers to be "block" elements, set through the CSS display: block;
declaration.
HTML also has a similar concept, although different, and the two are very frequently confused. %block;
and %inline;
are groups within the HTML DTD that group elements as being either "block-level" or "inline". This is used to define their nesting behavior: block-level elements cannot be placed into an inline context. This behavior cannot be changed; it is fixed in the DTD. Block and inline elements have the appropriate and different CSS behaviors attached to them by default, including the relevance of the box model for particular element types.
Note though that this CSS behavior can, and frequently is, changed from the default. Lists with <ul><li> ...
are %block;
elements and are presented as block elements by default. However, it is quite common to set these with CSS to display as an inline list.
In the HTML syntax, most elements are written with a start tag and an end tag, with the content in between. An HTML tag is composed of the name of the element, surrounded by angle brackets. An end tag also has a slash after the opening angle bracket, to distinguish it from the start tag. For example, a paragraph, which is represented by the element, would be written as:
<p>In the HTML syntax, most elements are written ...p>
However, not all of these elements require the end tag, or even the start tag, to be present. Some elements, the so-called void elements, do not have an end tag. A typical example is the
(hard line-break) element. A void element's behavior is predefined, and it cannot contain any content or other elements. For example, an address would be written as:
<p>P. Sherman<br>42 Wallaby Way<br>Sydneyp>
When using XHTML, it is required to open and close all elements, including void elements. This can be done by placing an end tag immediately after the start tag, but this is not legal in HTML 5 and will lead to two elements being created. An alternative way to specify that it is a void element, which is compatible with both XHTML and HTML 5, is to put a /
at the end of the tag (not to be confused with the /
at the beginning of a closing tag).
<p>P. Sherman<br />42 Wallaby Way<br />Sydneyp>
HTML attributes are specified inside the start tag. For example, the element, which represents an abbreviation, expects a
title
attribute within its opening tag. This would be written as:
<abbr title="abbreviation">abbr.abbr>
Informally, HTML elements are sometimes referred to as "tags" (an example of synecdoche), though many prefer the term tag strictly in reference to the markup delimiting the start and end of an element.
Element (and attribute) names may be written in any combination of upper or lower case in HTML, but must be in lower case in XHTML. The canonical form was upper-case until HTML 4, and was used in HTML specifications, but in recent years, lower-case has become more common.
There are three kinds of HTML elements: normal elements, raw text elements, and void elements.
Normal elements usually have both a start tag and an end tag, although for some elements the end tag, or both tags, can be omitted. It is constructed in a similar way:
<tag>
) marking the beginning of an element, which may incorporate any number of HTML attributes;tag>
.Raw text elements (also known as text or text-only elements) are constructed with:
<tag>
) marking the beginning of an element, which may incorporate any number of HTML attributes;tag>
. In some versions of HTML, the end tag is optional for some elements. The end tag is required in XHTML.An example is the
element must not contain other elements, only text. Only one
element is permitted in a document.In visual browsers, displayable elements can be rendered as either block or inline. While all elements are part of the document sequence, block elements appear within their parent elements:
Conversely, inline elements are treated as part of the flow of document text; they cannot have margins, width, or height set, and do break across lines.
Block elements, or block-level elements, have a rectangular structure. By default, these elements will span the entire width of its parent element, and will thus not allow any other element to occupy the same horizontal space as it is placed on.
The rectangular structure of a block element is often referred to as the box model, and is made up of several parts. Each element contains the following:
The above section refers only to the detailed implementation of CSS rendering and has no relevance to HTML elements themselves.
>...
P
existed in HTML Tags, and was standardized in HTML 2.0; still current.Html Element
An HTML element is a type of HTML (HyperText Markup Language) document component, one of several types of HTML nodes (there are also text nodes, comment nodes and others).
>...
>...
>...
>...
>...
h1
delimits the highest-level heading, h2
the next level down (sub-section), h3
for a level below that, and so on to h6
. They are sometimes referred to collectively as hn
tags, n meaning any of the available heading levels. Most visual browsers show headings as large bold text by default, though this can be overridden with CSS. Heading elements are not intended merely for creating large or bold text – in fact, they should not be used for explicitly styling text. Rather, they describe the document's structure and organization. Some programs use them to generate outlines and tables of contents.>...
DL
existed in HTML Tags, and was standardized in HTML 2.0; still current.- >...
DT
existed in HTML Tags, and was standardized in HTML 2.0; still current.- >...
DD
existed in HTML Tags, and was standardized in HTML 2.0; still current.>...
type
attribute can be used to specify the kind of marker to use in the list, but style sheets give more control. The default is Arabic numbering. In an HTML attribute: <ol type="foo">
; or in a CSS declaration: ol { list-style-type: foo; }
– replacing foo
with one of the following: A
; CSS value: upper-alpha
a
; CSS value: lower-alpha
I
; CSS value: upper-roman
i
; CSS value: lower-roman
1
; decimal
none
, and options for CJK, Hebrew, Georgian, and Armenian script. The attribute is deprecated in HTML 3.2 and 4.01, but not in HTML 5.OL
existed in HTML Internet Draft 1.2, and was standardized in HTML 2.0; still current.>...
<ul type="foo">
; or in a CSS declaration: ul { list-style-type: foo; }
– replacing foo
with one of the following (the same values are used in HTML and CSS): disc
(the default), square
, or circle
. Only the CSS method is supported in HTML5; the attribute is deprecated in HTML 3.2 and 4.01. CSS also provides none
, and the ability to replace these bullets with custom images.UL
existed in HTML Tags, and was standardized in HTML 2.0; still current.- >...
ol
) or unordered (ul
) lists.LI
existed in HTML Tags, and was standardized in HTML 2.0; still current.>... (deprecated)
<ul>
.DIR
existed in HTML Tags, and was standardized in HTML 2.0; deprecated in HTML 4.0 Transitional; invalid in HTML 4.0 Strict.>...
ADDRESS
existed in HTML Tags, and was standardized in HTML 2.0; still current.>...
>...
A block level quotation, for when the quotation includes block level elements, e.g. paragraphs. The cite
attribute (not to be confused with the element) may give the source, and must be a fully qualified Uniform Resource Identifier.
) element.BLOCKQUOTE
existed in HTML Internet Draft 1.2, and was standardized in HTML 2.0; still current. See blockquote element for more information.>... (deprecated)
or another element with centering defined using style sheets. - Standardized in HTML 3.2; deprecated in HTML 4.0; not supported in HTML5.
>...
- Marks a deleted section of content. This element can also be used as inline.
- Standardized in HTML 4.0; still current.
>...
- A block-level logical division. A generic element with no semantic meaning used to distinguish a document section, usually for purposes such as presentation or behavior controlled by style sheets or DOM calls.
- Proposed in the HTML 3.0 Drafts; Standardized in HTML 3.2; still current.
- Used to group images and captions, along with
. - Standardized in HTML5.
- A caption for an image. Always placed inside the
element. - Standardized in HTML5.
- Used for document footers. These might contain author or copyright information, or links to other pages.
- Standardized in HTML5.
>...
- Used for document headers. These typically contain content introducing the page.
- Standardized in HTML5.
/>
- A thematic break (originally: horizontal rule). Presentational rules can be drawn with style sheets.
- Standardized in HTML 2.0; still current.
>...
- Marks a section of inserted content. This element can also be used as inline.
- Standardized in HTML 4.0; still current.
>...Tags:
Html Element ConceptsHtml Element OverviewHtml Element Document structure elementsHtml Element Document head elementsHtml Element Document body elementsHtml Element FramesHtml Element Historic elementsHtml Element Non-standard elementsHtml Element CommentsHtml Element BibliographyHtml Element🔥 Trending searches on Wiki English:
Jimmy CarterArsenal F.C.2020 United States presidential electionAngela KinseyAlec BaldwinJennifer PanTravis KelceSexBlink TwiceManchester City F.C.War for the Planet of the Apes2024 Indian general electionJapanDeadpool & WolverineBenito MussoliniPolandTed BundyTom Goodman-HillBlack Sails (TV series)NapoleonCandidates Tournament 2024XXXX GoldGeorge W. BushPSV EindhovenGmailList of countries by GDP (nominal) per capitaBritish Post Office scandalThe First OmenThe Idea of YouNorth KoreaCaitlyn JennerMaldives2024 AFC Futsal Asian CupThe Fall Guy (2024 film)Ivy LeagueVietnam WarOutlook.comJerry SeinfeldMike Johnson (Louisiana politician)List of highest-grossing Malayalam filmsC (programming language)The Zone of Interest (film)Marvel Cinematic UniverseGermanyRestrictions on TikTok in the United StatesBill ClintonGeorge VWordleLa Liga2024 Indian general election in Tamil NaduLondonElon MuskNicole Brown SimpsonRussian invasion of UkraineTikTokClint EastwoodColumbine High School massacreApocalypse Now ReduxKevin De BruyneRichard Armitage (actor)Bitcoin protocolMaya RudolphLana Del ReyPremaluMadison BeerBitcoinJon Bon JoviRoad House (2024 film)MandisaNazriya NazimTito VilanovaOpinion polling for the 2024 Indian general electionJack NicholsonHarry PotterCharlie SheenTurkeyIndonesia national under-23 football team🡆 More
- Contains the main content of a document.
- Standardized in HTML 5.1.
- HTML 2.0: A menu listing. Should be more compact than a
list. MENU
existed in HTML Tags, and was standardized in HTML 2.0; deprecated in HTML 4.0 Transitional; invalid in HTML 4.0 Strict; then redefined in HTML5, removed in HTML 5.2, but is included in the HTML Living Standard in 2019. - Used in navigational sections of articles (areas of webpages which contain links to other webpages).
- Standardized in HTML5.
- Replacement content for scripts. Unlike script this can only be used as a block-level element.
- Standardized in HTML 4.0; still current.
>...
- Pre-formatted text. Text within this element is typically displayed in a non-proportional font exactly as it is laid out in the file (see ASCII art). Whereas browsers ignore white-space for other HTML elements, in
...
, white-space should be rendered as authored. (With the CSS properties: { white-space: pre; font-family: monospace; }
, other elements can be presented in the same way.) This element can contain any inline element except:
,
,
,
,
, and ...
. PRE
existed in HTML Internet Draft 1.2, and was standardized in HTML 2.0; still current. >...
- Used for generic sections of a document. This is different from
in that it is only used to contain sections of a page, which the W3C defines as a group of content with a similar theme. - Standardized in HTML5.
- Places a script in the document. Also usable in the head and in inline contexts. It may be used as
with a src
attribute to supply a URL from which to load the script, or used as
around embedded script content. Note:
- Places a script in the document. Also usable in the head and in block contexts. Note: