HTML element

Individual component of an HTML document


title: "HTML element" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["html-tags", "web-1.0"] description: "Individual component of an HTML document" topic_path: "technology/web" source: "https://en.wikipedia.org/wiki/HTML_element" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Individual component of an HTML document ::

An HTML element is a type of HTML (HyperText Markup Language) document component, one of several types of HTML nodes (some common node types include document, document fragment and attribute nodes). 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 a 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.

Concepts

::figure[src="https://upload.wikimedia.org/wikipedia/commons/1/10/HTML_element_content_categories.svg" caption="HTML element content categories" alt="Euler diagram of HTML element content categories."] ::

Elements vs. tags

As is generally understood, the position of an element is indicated as spanning from a start tag and is terminated by an end tag.{{Cite web |at=§3.2.1 Elements |title=§3 On SGML and HTML |work=HTML 4.01 Specification |date=24 December 1999 |url=http://www.w3.org/TR/1999/REC-html401-19991224/intro/sgmltut.html#h-3.2.1 |publisher=W3C

::quote 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:

::quote 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:

::quote 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,{{Cite web |at=§3.1 Introduction to SGML |title=§3 On SGML and HTML |work=HTML 4.01 Specification |date=24 December 1999 |url=http://www.w3.org/TR/1999/REC-html401-19991224/intro/sgmltut.html |publisher=W3C |title=HTML 4.01, §21, Document Type Definition |date=24 December 1999 |url=http://www.w3.org/TR/1999/REC-html401-19991224/sgml/dtd.html |publisher=W3C

SGML vs. XML

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.{{refn|group=note|One minor difference is that XML, even after the DOM interface, is case-sensitive.{{Cite web |at=§1.3. XHTML and the HTML DOM |work=Document Object Model (DOM) Level 2 HTML Specification |date=9 January 2003 |title=§1. Document Object Model HTML |url=http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-5353782642 |publisher=W3C

%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 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".{{Cite web |at=§7.5.3 Block-level and inline elements |title=§7 The global structure of an HTML document |work=HTML 4.01 Specification |date=24 December 1999 |url=http://www.w3.org/TR/1999/REC-html401-19991224/struct/global.html#h-7.5.3 |publisher=W3C

Note though that this CSS behavior can, and frequently is, changed from the default. Lists with 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.{{Cite web |title=CSS Design: Taming Lists |author=Mark Newhouse |date=27 September 2002 |url=http://alistapart.com/article/taminglists/ |publisher=A List Apart

Overview

Syntax

|content= \overbrace{ \overbrace{\mathtt{\color{BrickRed}}}^\mathsf{Start\ tag} \overbrace\mathtt{\color{Green}This\ is\ a\ paragraph.}^\mathsf{Content} \overbrace\mathtt{\color{BrickRed}}^\mathsf{End \atop tag} }^\mathsf{Element} 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: ::code[lang=html]

In the HTML syntax, most elements are written ...

::

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: ::code[lang=html]

P. Sherman
42 Wallaby Way
Sydney

::

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). ::code[lang=html]

P. Sherman
42 Wallaby Way
Sydney

::

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: ::code[lang=html] 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.

Types of element

There are three kinds of HTML elements: normal elements, raw text elements, and void 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:

  • a start tag () marking the beginning of an element, which may incorporate any number of HTML attributes;
  • some amount of content, including text and other elements;
  • an end tag, in which the element name is prefixed with a slash: .

**** (also known as text or text-only elements) are constructed with:

  • a start tag (in the form ) marking the beginning of an element, which may incorporate any number of HTML attributes;
  • some amount of text content, but no elements (all tags, apart from the applicable end tag, will be interpreted as content);
  • an end tag, in which the element name is prefixed with a slash: . 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, which must not contain other elements (including markup of text), only plain text.

Empty element (also sometimes called empty elements, single elements or stand-alone elements) only have a start tag (in the form ), which contains any HTML attributes. They may not contain any children, such as text or other elements. For compatibility with XHTML, the HTML specification allows an optional space and slash ( is permissible). The slash is required in XHTML and other XML applications. Two common void elements are (for a hard line-break, such as in a poem or an address) and (for a thematic break). Other such elements are often place-holders which reference external files, such as the image () element. The attributes included in the element will then point to the external file in question. Another example of a void element is , for which the syntax is: ::code[lang=html]

This {{code|lang=html|code=}} element points the browser at a [[Style sheet (web development)|style sheet]] to use when presenting the HTML document to the user. In the HTML syntax attributes do not have to be quoted if they are composed only of certain characters: letters, digits, the hyphen-minus and the period. When using the XML syntax (XHTML), on the other hand, all attributes must be quoted, and a spaced trailing [[Slash (punctuation)|slash]] is required before the last angle bracket: ::

Attributes

HTML attributes define desired behavior or indicate additional element properties. Most attributes require a value. In HTML, the value can be left unquoted if it does not include spaces (attribute=value), or it can be quoted with single or double quotes (attribute='value' or attribute="value"). In XML, those quotes are required.

Boolean attributes, on the other hand, do not require a value to be specified. An example is the checked for checkboxes: ::code[lang=html] ::

In the XML (and thus XHTML) syntax, though, a value is required, and the name should be repeated as the value: ::code[lang=xml] ::

Element standards

HTML elements are defined in a series of freely available open standards issued since 1995, initially by the IETF and subsequently by the W3C.

During the browser wars of the 1990s, developers of user agents (e.g. web browsers) often developed their own elements, some of which have been adopted in later standards. Other user agents may not recognize non-standard elements, and they will be ignored, possibly causing the page to be displayed improperly.

In 1998, XML (a simplified form of SGML) introduced mechanisms to allow anyone to develop their own elements and incorporate them in XHTML documents, for use with XML-aware user agents.

Subsequently, HTML 4.01 was rewritten in an XML-compatible form, XHTML 1.0 (eXtensible HTML). The elements in each are identical, and in most cases valid XHTML 1.0 documents will be valid or nearly valid HTML 4.01 documents. This article mainly focuses on real HTML, unless noted otherwise; however, it remains applicable to XHTML. See HTML for a discussion of the minor differences between the two.

Element status

Since the first version of HTML, several elements have become outmoded, and are deprecated in later standards, or do not appear at all, in which case they are invalid (and will be found invalid, and perhaps not displayed, by validating user agents).

In HTML 4.01 / XHTML 1.0, the status of elements is complicated by the existence of three types of DTD:

  • Transitional, which contain deprecated elements, but which were intended to provide a transitional period during which authors could update their practices;
  • Frameset, which are versions of the Transitional DTDs which also allow authors to write frameset documents;
  • Strict, which is the up-to-date (as at 1999) form of HTML.

HTML5 instead provides a listing of obsolete features to go along with the standardized normative content. They are broken down into "obsolete but conforming" for which implementation instructions exist and "non-conforming" ones that should be replaced.

The first Standard (HTML 2.0) contained four deprecated elements, one of which was invalid in HTML 3.2. All four are invalid in HTML 4.01 Transitional, which also deprecated a further ten elements. All of these, plus two others, are invalid in HTML 4.01 Strict. While the frame elements are still current in the sense of being present in the Transitional and Frameset DTDs, there are no plans to preserve them in future standards, as their function has been largely replaced, and they are highly problematic for user accessibility.

(Strictly speaking, the most recent XHTML standard, XHTML 1.1 (2001), does not include frames at all; it is approximately equivalent to XHTML 1.0 Strict, but also includes the Ruby markup module.)

A common source of confusion is the loose use of deprecated to refer to both deprecated and invalid status, and to elements that are expected to be formally deprecated in the future.

Content vs. presentation and behavior

Since HTML 4, HTML has increasingly focused on the separation of content (the visible text and images) from presentation (like color, font size, and layout).{{Cite web |title=HTML & CSS |url=http://www.w3.org/standards/webdesign/htmlcss |year=2013 |publisher=W3C |title=Appendix D. Default style sheet for HTML 4 |work=Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification |date=7 June 2011 |url=http://www.w3.org/TR/CSS2/sample.html |publisher=W3C

Behavior (interactivity) is also kept separate from content, and is handled by scripts. Images are contained in separate graphics files, separate from text, though they can also be considered part of the content of a page.

Separation of concerns allows the document to be presented by different user agents according to their purposes and abilities. For example, a user agent can select an appropriate style sheet to present a document by displaying on a monitor, printing on paper, or to determine speech characteristics in an audio-only user agent. The structural and semantic functions of the markup remain identical in each case.

Historically, user agents did not always support these features. In the 1990s, as a stop-gap, presentational elements (like and ) were added to HTML, at the cost of creating problems for interoperability and user accessibility. This is now regarded as outmoded and has been superseded by style sheet-based design; most presentational elements are now deprecated.

External image files are incorporated with the or elements. (With XHTML, the SVG language can also be used to write graphics within the document, though linking to external SVG files is generally simpler.) Where an image is not purely decorative, HTML allows replacement content with similar semantic value to be provided for non-visual user agents.

An HTML document can also be extended through the use of scripts to provide additional behaviors beyond the abilities of HTML hyperlinks and forms.

The elements and , with related HTML attributes, provide style sheets and scripts.

  • In the document head, and may link to shared external documents, or and may contain embedded instructions. (The element can also be used to link style sheets.)
  • or can occur at any point in the document (head or body).
  • The style attribute is valid in most document body elements (e.g. ) for inclusion of inline style instructions.
  • Event-handling attributes, which provide links to scripts, are optional in most elements.
  • For user agents which do not operate scripts, the element provides embedded alternative content where appropriate; however, it can only be used in the document head and in the body as a block-level element.

Document structure elements

Container for processing information and metadata for an HTML document.

Container for the displayable content of an HTML document.

Document head elements

::figure[src="https://upload.wikimedia.org/wikipedia/commons/9/9d/ISINDEX_HTML_tag_in_Netscape_Navigator_3.gif" caption="Netscape]] 3.0."] ::

A less-common, but important, usage is to supply navigation hints consistently through use of microformats. Several common relationships are defined, that may be exposed to users through the browser interface rather than directly in the web page, such as: .

A document's element may contain any number of elements. This element has HTML attributes, but no contents.

Can be used to specify additional metadata about a document, such as its author, publication date, expiration date, language, page title, page description, keywords, or other information not provided through the other header elements and HTML attributes. Because of their generic nature, elements specify associative key-value pairs. In general, a meta element conveys hidden information about the document. Several meta tags can be used, all of which should be nested in the head element. The specific purpose of each element is defined by its attributes. Outside of XHTML, it is often given without the slash (), despite being a void element.

In one form, elements can specify HTTP headers which should be sent by a web server before the actual content. For example, specifies that the page should be served with an HTTP header called foo that has a value bar.

In the general form, a element specifies name and associated content HTML attributes describing aspects of the HTML page. To prevent possible ambiguity, an optional third attribute, scheme, may be supplied to specify a semantic framework that defines the meaning of the key and its value. For example, in the element identifies itself as containing the foo element, with a value of bar, from the DC or Dublin Core resource description framework.

Can either act as a container for style instructions or link to external style sheets – for example, in CSS, with @import directives of the form,

  • Web browsers usually display it in a window's title bar when the window is open, and (where applicable) in the task bar when the window is minimized.
  • It may become the default file-name when saving the page.
  • We can use element only one time in a web page, and when we make another page then we will use again another element with new title (do not take same name for all title tag in website, It can be problem for search engines).
  • Web search engines' web crawlers may pay particular attention to the words used in the title. The element must not contain other elements, only text. Only one element is permitted in a document.

Document body elements

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:

  • as rectangular objects which do not break across lines;
  • with block margins, width, and height properties which can be set independently of the surrounding 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

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 CSS box model, and is made up of several parts. Each element contains the following:

  • The content of an element is the actual text (or other media) placed between the opening and closing tags of an element.
  • The padding of an element is the space around the content but which still forms part of the element. Padding should not be used to create white space between two elements. Any background style assigned to the element, such as a background image or color, will be visible within the padding. Increasing the size of an element's padding increases the amount of space this element will take up.
  • The border of an element is the absolute end of an element and spans the perimeter of that element. The thickness of a border increases the size of an element.
  • The margin of an element is the white space that surrounds an element. The content, padding, and border of any other element will not be allowed to enter this area unless forced to do so by some advanced CSS placement. Using most standard DTDs, margins on the left and right of different elements will push each other away. Margins on the top or bottom of an element, on the other hand, will not stack or will intermingle. This means that the white space between these elements will be as big as the larger margin between them.

The above section refers only to the detailed implementation of CSS rendering and has no relevance to HTML elements themselves.

Basic text

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.

Lists

dl A description list (a.k.a. association list or definition list) consists of name–value groups, and was known as a definition list prior to HTML5. Description lists are intended for groups of "terms and definitions, metadata topics and values, questions and answers, or any other groups of name–value data".

  • A, B, C ... – HTML value: A; CSS value: upper-alpha
  • a, b, c ... – HTML value: a; CSS value: lower-alpha
  • I, II, III ... – HTML value: I; CSS value: upper-roman
  • i, ii, iii ... – HTML value: i; CSS value: lower-roman
  • 1, 2, 3 ... – HTML value: 1; decimal CSS provides several other options not available as pure-HTML markup, including 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.

Other block elements

Used for articles and other similar content.

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.

The default presentation of block quotations in visual browsers is usually to indent them from both margins. This has led to the element being unnecessarily used just to indent paragraphs, regardless of semantics. For quotations not containing block level elements see the quote () element.

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.}}

Note: is not itself either a block or inline element; by itself it should not display at all, but it can contain instructions to dynamically generate either both block or inline content.}}

Inline elements

Inline elements cannot be placed directly inside the element; they must be wholly nested within block-level elements.

Anchor

In HTML, an "anchor" can be either the origin (the anchor text) or the target (destination) end of a hyperlink. As an origin, setting the attribute href, creates a hyperlink; it can point to either another part of the document or another resource (e.g. a webpage) using an external URL. As a target, setting the name or id HTML attributes, allows the element to be linked from a Uniform Resource Locator (URL) via a fragment identifier. The two forms, origin and anchor, can be used concurrently.

In HTML5, any element can now be made into a target by using the id attribute, so using is not necessary, although this way of adding anchors continues to work.

To illustrate: the header of a table of contents section on example.com's homepage could be turned into a target by writing: . Now that the section has been marked up as a target, it can be referred to from external sites with a link like: ; or with a link on the same page like: .

The attribute title may be set to give brief information about the link: .

In most graphical browsers, when the cursor hovers over a link, the cursor changes into a hand with an extended index finger and the title value is displayed in a tooltip or in some other manner. Some browsers render alt text the same way, although this is not what the specification calls for.

A existed in HTML Tags, and was standardized in HTML 2.0.

Phrase elements

Phrase elements are used for marking up phrases and adding structure or semantic meaning to text fragments. For example, the and tags can be used for adding emphasis to text.

General

An aural user agent may use different voices for emphasis.

Computer phrase elements

These elements are useful primarily for documenting computer code development and user interaction through differentiation of source code (), variables (), user input (), and terminal or other output ().

Presentation

As visual presentational markup only applies directly to visual browsers, its use is discouraged. Style sheets should be used instead. Several of these elements are deprecated or invalid in HTML 4 / XHTML 1.0, and the remainder are invalid in the current draft of XHTML 2.0. The current draft of HTML5, however, re-includes , , and , assigning new semantic meaning to each. In an HTML5 document, the use of these elements is no longer discouraged, provided that it is semantically correct. In HTML 4, set font to boldface where possible. Equivalent CSS: . The element usually has the same effect in visual browsers, as well as having more semantic meaning, under HTML 4.01.

In HTML5, however, has its own meaning, distinct from that of . It denotes "text to which attention is being drawn for utilitarian purposes without conveying any extra importance and with no implication of an alternate voice or mood."

In HTML 4, set font to italic where possible. Equivalent CSS: . Using has the same visual effect in most browsers, as well as having a semantic meaning as emphasis, under HTML 4.01. (Purely typographic italics have many non-emphasis purposes, as HTML 5 more explicitly recognized.)

In HTML5, however, has its own semantic meaning, distinct from that of . It denotes "a different quality of text" or "an alternate voice or mood" e.g., a thought, a ship name, a binary species name, a foreign-language phrase, etc.

In HTML5, the element denotes "a span of text with an unarticulated, though explicitly rendered, non-textual annotation, such as labelling the text as being a proper name in Chinese text (a Chinese proper name mark), or labelling the text as being misspelt." The HTML5 specification reminds developers that other elements are almost always more appropriate than and admonishes designers not to use underlined text where it could be confused for a hyper-link.

In HTML5, the element denotes "side comments such as small print." This has caused some confusion with the element.

In HTML5, the element denotes information that is "no longer accurate or no longer relevant", and is not to be confused with , which indicates removal/deletion.

Can specify the font color with the color attribute (note the American spelling), typeface with the face attribute, and absolute or relative size with the size attribute.

Examples (all uses are deprecated, use CSS equivalents if possible):

  • creates .
  • creates text with hexadecimal color #114499.
  • creates text with size 4. Sizes are from 1 to 7. The standard size is 3, unless otherwise specified in the or other tags.
  • creates text with size 1 bigger than the standard. is opposite.
  • makes text with Courier font.

Equivalent CSS for font attributes:

  • font size="N" corresponds to {font-size: Yunits} (the HTML specification does not define the relationship between size N and unit-size Y, nor does it define a unit).
  • corresponds to
  • corresponds to – CSS supports a font stack, of two or more alternative fonts.

Span

An inline 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.

Other inline elements

Another problem with the element is that WHATWG recommends that it be italicized by default (thus almost all browsers do so), because it (in their view) is only for publication titles. By convention, however, only certain kinds of titles actually take italics, while others are expected to be put in quotation marks, and standards may actually vary by publishing context and language. Consequently, many website authors and admins use a site-wide stylesheet to undo this element's auto-italics.

should automatically generate quotation marks in conjunction with style sheets. Practical concerns due to browser non-compliance may force authors to find workarounds.

The cite attribute gives the source, and must be a fully qualified URI.

Note: is not itself either a block or inline element; by itself it should not display at all, but it can contain instructions to dynamically generate either both block or inline content.

Images and objects

Adds a canvas whose contents can be edited with JavaScript. Frequently used for online games.}}

| website=MSDN | access-date=2009-07-22}} Safari and Google Chrome, on the other hand, do not display the alt attribute at all.) The element was first proposed by Marc Andreessen and implemented in the NCSA Mosaic web browser.}}

Forms

Main article: Form (HTML)

These elements can be combined into a form or in some instances used separately as user-interface controls; in the document, they can be simple HTML or used in conjunction with Scripts. HTML markup specifies the elements that make up a form, and the method by which it will be submitted. However, some form of scripts (server-side, client-side, or both) must be used to process the user's input once it is submitted.

(These elements are either block or inline elements, but are collected here as their use is more restricted than other inline or block elements.)

operated as a primitive HTML search form; but was de facto obsoleted by more advanced HTML forms introduced in the early to mid-1990s. Represents a set of hyperlinks composed of a base URI, an ampersand and percent-encoded keywords separated by plus signs.}}

Tables

The format of HTML Tables was proposed in the HTML 3.0 Drafts and the later RFC 1942 HTML Tables. They were inspired by the CALS Table Model. Some elements in these proposals were included in HTML 3.2; the present form of HTML Tables was standardized in HTML 4. (Many of the elements used within tables are neither block nor inline elements.)

Frames

Main article: Frame (World Wide Web)

Frames allow a visual HTML browser window to be split into segments, each of which can show a different document. This can lower bandwidth use, as repeating parts of a layout can be used in one frame, while variable content is displayed in another. This may come at a certain usability cost, especially in non-visual user agents, due to separate and independent documents (or websites) being displayed adjacent to each other and being allowed to interact with the same parent window. Because of this cost, frames (excluding the element) are only allowed in HTML 4.01 Frame-set. Iframes can also hold documents on different servers. In this case the interaction between windows is blocked by the browser. Sites like Facebook and Twitter use iframes to display content (plugins) on third party websites. Google AdSense uses iframes to display banners on third party websites.

In HTML 4.01, a document may contain a and a or a and a , but not both a and a . However, can be used in a normal document body.

The content of the element is used as alternative text to be displayed if the browser does not support inline frames.

A separate document is linked to a frame using the src attribute inside the , an inline HTML code is embedded to a frame using the srcdoc attribute inside the element.}}

{{anchor|Longdesc}}longdesc attribute

In HTML, longdesc is an attribute used within the , , or elements. It is supposed to be a URL to a document that provides a long description for the image, frame, or iframe in question. This attribute should contain a URL, not – as is commonly mistaken – the text of the description itself.

longdesc was designed to be used by screen readers to display image information for computer users with accessibility issues, such as the blind or visually impaired, and is widely implemented by both web browsers and screen readers. Some developers object that it is actually seldom used for this purpose because there are relatively few authors who use the attribute and most of those authors use it incorrectly; thus, they recommend deprecating longdesc. The publishing industry has responded, advocating the retention of longdesc.

Example

::code[lang=html] ::

Content of description.html: ::code[lang=html]

This is an image of a two-layered birthday cake.

... ::

Linking to the long description in the text

Since very few graphical browsers support making the link available natively (Opera and iCab being the exceptions), it is useful to include a link to the description page near the element whenever possible, as this can also aid sighted users.

Example

::code[lang=html] [D] ::

Historic elements

The following elements were part of the early HTML developed by Tim Berners-Lee from 1989 to 1991; they are mentioned in HTML Tags, but deprecated in HTML 2.0 and were never part of HTML standards.

Non-standard elements

::quote

::

| width = 250px | class = noprint | quote = | source = Example of marquee text from the first Wikipedia edit (accomplished via CSS; the tag itself is deprecated and no longer works in most browsers) ::quote

::

| width = 250px | class = noprint | quote = | source = Example of blinking text (accomplished via CSS; the tag itself is deprecated and no longer works in most browsers) with link to page. Not to be confused with UwU, this page contains the earliest surviving edit on the English Wikipedia.}} This section lists some widely used obsolete elements, which means they are not used in valid code. They may not be supported in all user agents.

Causes text to blink. Introduced in imitation of the ANSI escape codes. Can be done with CSS where supported: (This effect may have negative consequences for people with photosensitive epilepsy; its use on the public Internet should follow the appropriate guidelines.)}}

Creates an absolute positioned and framed layer. Can be done with frames and/or CSS instead. There are attributes, including ID, LEFT, TOP, PAGEX, PAGEY, SRC, Z-INDEX, ABOVE, WIDTH, HEIGHT, BELOW, CLIP, VISIBILITY and CLIP.}}

Creates scrolling text. Can be done with scripting instead. (This effect may have negative consequences for people with photosensitive epilepsy; its use on the public Internet should follow the appropriate guidelines.) There are three options, including Alternate, Scroll and slide. Scrolldelay can also be added.}}

Comments

A comment in HTML (and related XML, SGML and SHTML) uses the same syntax as the SGML comment or XML comment, depending on the doctype.

Unlike most HTML tags, comments do not nest. More generally, there are some strings that are not allowed to appear in the comment text. Those are (the beginning of a comment),(this ends the comment so it trivially follows it can not appear inside it) and . Additionally, the strings and cannot appear at the beginning of a comment and {{code|lang=html|code=

As a result, the markup is ill-formed and will yield the comment after it, or sometimes just , depending on the browser.

Comments can appear anywhere in a document, as the HTML parser is supposed to ignore them no matter where they appear so long as they are not inside other HTML tag structures (i.e., they cannot be used next to attributes and values; this is invalid markup: ).

Comments can even appear before the doctype declaration; no other tags are permitted to do this.

However, not all browsers and HTML editors are fully compliant with the HTML syntax framework and may do unpredictable things under some syntax conditions. Defective handling of comments only affects about 5% of all browsers and HTML editors in use, and even then only certain versions are affected by comment mishandling issues (Internet Explorer 6 accounts for most of this high percentage).

There are a few compatibility quirks involving comments:

  • Placing comments – or indeed any characters except for white-space – before the doctype will cause Internet Explorer 6 to use quirks mode for the HTML page. None of the doctype information will be processed.
  • For compatibility with some pre-1995 browsers, the contents of and elements are still sometimes surrounded by comment delimiters, and CSS- and script-capable browsers are written to specifically ignore that comment markup as not actually a comment. This means that attempts to actually comment out CSS and script markup by change the elements inside the comment to not be recognized, e.g. ``.
  • The BlueGriffon HTML editor, in versions 1.7.x, makes comments that are not embedded in the syntax structure; will show up on-screen. Other HTML editors may have this same defect.

Notes

References

Bibliography

HTML standards

;HTML 2.0 :{{cite IETF |last1=Berners-Lee |first1=Tim |author1-link=Tim Berners-Lee |last2=Connolly |first2=Dan |author2-link=Dan Connolly (computer scientist) |title=Hypertext Markup Language - 2.0 (RFC 1866) |publisher=IETF |date=November 1995 |rfc=1866 |access-date=2009-03-24}} ;HTML 3.2 :{{cite web |last=Raggett |first=Dave |author-link=Dave Raggett |title=HTML 3.2 Reference Specification |publisher=W3C |date=1997-01-14 |url= http://www.w3.org/TR/REC-html32-19970114 |access-date=2009-03-27}} ;HTML 4.01 :{{cite web |last1=Raggett |first1=Dave |author-link=Dave Raggett |last2=Le Hors |first2=Arnaud |last3=Jacobs |first3=Ian |title=HTML 4.01 Specification |publisher=W3C |date=1999-12-24 |url= https://www.w3.org/TR/html4/ |access-date=2009-03-24}} (HTML 4.01 superseded 4.0 (1998), which was never widely implemented, and all earlier versions. Superseded in turn on 2018-03-27 by HTML 5.2). ;XHTML 1.0 :{{cite web |title=XHTML 1.0: The Extensible HyperText Markup Language (Second Edition) |version=Revised version |publisher=W3C |date=2002-08-01 |orig-date=2000 |url= https://www.w3.org/TR/xhtml1/ |access-date=2009-03-24}} ;XHTML 1.1 :{{cite web |editor1-last=Altheim |editor1-first=Murray |editor2-last=McCarron |editor2-first=Shane |editor3-last=Ishikawa |editor3-first=Masayasu |title=XHTML 1.1 - Module-based XHTML - Second Edition |version=Revised version |publisher=W3C |date=2010-11-23 |orig-date=2001 |url= https://www.w3.org/TR/xhtml11/ |access-date=2018-07-26}} (Superseded on 2018-03-27 by HTML 5.2.) :{{cite web |editor1-last=Austin |editor1-first=Daniel |editor2-last=Peruvemba |editor2-first=Subramanian |editor3-last=McCarron |editor3-first=Shane |editor4-last=Ishikawa |editor4-first=Masayasu |editor5-last=Birbeck |editor5-first=Mark |editor6-last=Altheim |editor6-first=Murray |editor7-last=Boumphrey |editor7-first=Frank |editor8-last=Dooley |editor8-first=Sam |editor9-last=Schnitzenbaumer |editor9-first=Sebastian |editor10-last=Wugofski |editor10-first=Ted |title=XHTML Modularization 1.1 - Second Edition |version=Revised version |publisher=W3C |date=2010-07-29 |orig-date=2006 |url= https://www.w3.org/TR/xhtml-modularization/ |access-date=2018-07-26}} (A more detailed version of the above. Also superseded on 2018-03-27 by HTML 5.2.) ;W3C HTML 5.2 :{{cite web |editor1-last=Faulkner |editor1-first=Steve |editor2-last=Eicholz |editor2-first=Arron |editor3-last=Leithead |editor3-first=Travis |editor4-last=Danilo |editor4-first=Alex |editor5-last=Moon |editor5-first=Sangwhan |editor6-last=Doyle Navara |editor6-first=Erika |editor7-last=O'Connor |editor7-first=Theresa |editor8-last=Berjon |editor8-first=Robin |title=HTML 5.2 W3C Recommendation |version=Revised version |publisher=W3C |date=2017-12-14 |orig-date=2016 |url= https://www.w3.org/TR/html52/ |access-date=2018-07-26}} Supersedes all previous versions of HTML and XHTML, including HTML 5.1. ;WHATWG HTML5 Living Standard :{{cite web |editor-first=Ian |editor-last=Hickson |editor-link=Ian Hickson |title=HTML Living Standard |version=One-page Version |publisher=WHATWG |date=2018-07-25 |url= https://html.spec.whatwg.org/ |access-date=2018-07-26}} Also available as a Multipage Version, and Developer's Edition (also multi-page, with a search function and other gadgets, and minus details only of interest to browser vendors).

Other sources

;HTML Tags :{{cite web |last=Berners-Lee |first=Tim |author-link=Tim Berners-Lee |title=HTML Tags |date=1992-11-03 |url= http://www.w3.org/History/19921103-hypertext/hypertext/WWW/MarkUp/Tags.html |access-date=2009-03-28}} (Part of the first published description of HTML.) ;HTML Internet Draft 1.2 :{{cite web |last1=Berners-Lee |first1=Tim |author1-link=Tim Berners-Lee |last2=Connolly |first2=Dan |author2-link=Dan Connolly (computer scientist) |title=Hypertext Markup Language (HTML) |date=June 1993 |url= http://www.w3.org/MarkUp/draft-ietf-iiir-html-01.txt |access-date=2009-03-28}} ;HTML 3.0 Drafts :{{cite web |last=Raggett |first=Dave |author-link=Dave Raggett |title=HyperText Markup Language Specification Version 3.0 (draft) |date=1995-03-24 |url= http://www.w3.org/MarkUp/html3/CoverPage.html |access-date=2009-04-18}} (This is the final draft of HTML 3.0, which expired without being developed further.) ;HTML Tables :{{cite IETF |last=Raggett |first=Dave |title=HTML Tables (RFC 1942) |publisher=IETF |date=May 1996 |rfc= 1942 |access-date = 2009-03-22}} ;XML 1.0 :{{cite web |editor1-last=Bray |editor1-first=Tim |editor1-link=Tim Bray |editor2-last=Paoli |editor2-first=Jean |editor2-link=Jean Paoli |editor3-last=Sperberg-McQueen |editor3-first=C. Michael |editor3-link=Michael Sperberg-McQueen |editor4-last=Maler |editor4-first=Eve |editor5-last=Yergeau |editor5-first=François |title=Extensible Markup Language (XML) 1.0 (Fifth Edition) |publisher=W3C |date=2008-11-26 |url= http://www.w3.org/TR/xml/ |access-date=2009-03-20}} ;CSS 1 :{{cite web |last1=Lie |first1=Håkon Wium |author1-link=Håkon Wium Lie |last2=Bos |first2=Bert |author2-link=Bert Bos |title=Cascading Style Sheets, Level 1 |version=Revised version |publisher=W3C |date=2008-04-11 |orig-date=1996 |url= http://www.w3.org/TR/CSS1/ |access-date=2018-07-26}} ;CSS 2.1 :{{cite web |last1=Bos |first1=Bert |author1-link=Bert Bos |last2=Çelik |first2=Tantek |author2-link=Tantek Çelik |last3=Hickson |first3=Ian |author3-link=Ian Hickson |last4=Lie |first4=Håkon Wium |author4-link=Håkon Wium Lie |title=Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification |version=Revised version |publisher=W3C |date=12 April 2016 |orig-date=2011 |url= https://www.w3.org/TR/CSS2/ |access-date=2018-07-26}} ;CSS 3 and 4 :{{cite web |last1=Atkins |first1=Tab Jr. |last2=Eternad |first2=Elika J. |last3=Rivoal |first3=Florian |title=CSS Snapshot 2017 |at=§2. Cascading Style Sheets (CSS) – The Official Definition |publisher=W3C |date=31 January 2017 |url= https://www.w3.org/TR/CSS/#css |access-date=2018-07-26}} (List of active specifications that have superseded CSS 2.1, as of the publication date.) :{{cite web |author= |title=CSS Current Status |publisher=W3C |date=2018 |url= https://www.w3.org/standards/techs/css#w3c_all |access-date=2018-07-26}} (CSS levels 3 and 4 are developed as independent modules, indexed at that page.)

References

  1. mozilla.org contributors. (2025-08-18). "Node - DOM API".
  2. "On SGML and HTML".
  3. (2025-09-14). "HTML 5.1 2nd Edition § 8.1.2.4. Optional tags".
  4. "HTML Standard § Optional tags".
  5. [[#XHTML10. XHTML 1.0]] §4.2
  6. [[#XML10. XML 1.0]] (The ability to produce additional elements is part of the ''eXtensibility'' in the acronym.)
  7. [[#XML10. XML 1.0]] §5.1
  8. [[#WHATWGLS. WHATWGLS]]. § 15
  9. [[#XHTML11. XHTML 1.1]] §A
  10. [[#HTML401. HTML 4.01]] §14.1
  11. (2003-01-14). "§2.3 Options for using SVG in Web pages". [[W3C]].
  12. [[#HTML401. HTML 4.01]] §12.3
  13. [[#HTML401. HTML 4.01]] §14.3.2
  14. [[#HTML401. HTML 4.01]] §18
  15. [[#CSS1. CSS]] §1.1
  16. (28 October 2014). "4.4 Grouping content – HTML5". [[World Wide Web Consortium]].
  17. (24 December 1999). "Lists in HTML documents". World Wide Web Consortium.
  18. (5 April 2011). "HTML5: A Vocabulary and Associated APIs for HTML and XHTML, W3C Working Draft".
  19. "HTML 4.01". W3C.
  20. (2005). "HTML 4 for dummies". Wiley.
  21. "ServerWriter -- /Provider".
  22. "HTML 5.2".
  23. [https://www.w3schools.com/tags/tag_acronym.asp Acronym tag], acronym.
  24. "4.6 Text-level semantics — The b element". Developers.whatwg.org.
  25. "4.6 Text-level semantics — The i element". Developers.whatwg.org.
  26. "4.6 Text-level semantics — The u element". Developers.whatwg.org.
  27. "4.6 Text-level semantics — The small element". Developers.whatwg.org.
  28. "4.6 Text-level semantics — The s element". Developers.whatwg.org.
  29. "11 Obsolete features — HTML5". W3C.
  30. (29 October 2014). "HTML5 specification finalized, squabbling over specs continues". Ars Technica.
  31. (24 December 1999). "9.2.1 Phrase elements: EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ABBR, and ACRONYM". [[W3C]].
  32. [[#HTML52. ''HTML 5.2 W3C Recommendation'']], at [https://www.w3.org/TR/html52/textlevel-semantics.html#the-cite-element "§4.5.6. The cite element"].
  33. [[#WHATWGLS. ''HTML Living Standard'']], at [https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-cite-element "§4.5.6 The cite element"].
  34. "<data>".
  35. "HTML <rb> Tag".
  36. "<rp>: The Ruby Fallback Parenthesis element".
  37. "<rt>: The Ruby Text element".
  38. "<rtc>: The Ruby Text Container element".
  39. "<ruby>".
  40. "<template>".
  41. "<time>".
  42. . (2025). ["<wbr>"](https://web-platform-dx.github.io/web-features-explorer/features/wbr/). *[[World Wide Web Consortium*.
  43. . (2003). ["<wbr> (Word Break"](https://www.htmlref.com/reference/appa/tag_wbr.htm). *PINT Inc. & The McGraw-Hill Companies*.
  44. "<wbr>".
  45. [http://webdesign.about.com/od/htmltags/p/bltags_embed.htm Jennifer Kyrnin ] {{Webarchive. link. (2012-11-02 {{tag). embed. o
  46. [https://www.w3schools.com/tags/tag_embed.asp W3Schools] about {{tag. embed. o
  47. The alt attribute's text cannot be styled with markup; as a result, other methods of alternative text presentation, such as [[Fahrner Image Replacement]], have been devised to accommodate situations in which the coder wishes styled text to be displayed if images are disabled in a user's browser.
  48. "Bug 5566 – ALT attribute value sometimes not displayed when image is missing". Bugs.webkit.org.
  49. "WWW-Talk Jan-Mar 1993: proposed new tag: IMG". 1997.webhistory.org.
  50. "Are frames accessible?".
  51. "Objects, Images, and Applets". W3C.
  52. "InState Longdesc".
  53. "Creating Accessible Images". WebAim.
  54. "Longdesc usage - WHATWG Wiki". Wiki.whatwg.org.
  55. "Bug 13461 - Commentary on Issue #30 (longdesc) from the Association of American Publishers".
  56. (July 22, 2022). "Obsolete – Non-conforming features". [[WHATWG]].
  57. (24 February 2023). "<xmp>".
  58. (1999-05-05). "Web Content Accessibility Guidelines 1.0". World Wide Web Consortium.
  59. "HTML standard".

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

html-tagsweb-1.0