FazBrowse Wikipedia Viewer | Main Page |
Search Wikipedia:
|
Viewing: https://en.wikipedia.org/wiki/HTML_element

HTML element

Contents
Overview
    Syntax
        Types of element
        Attributes
    Element standards
    Element status
    Content vs. presentation and behavior
Document structure elements
Document body elements
    Block elements
        Basic text
        Lists

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, interface 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.

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 <html> element, even if the string <html> 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 </p> tag indicating its end. But since the DTD states that paragraph elements cannot be nested, an HTML document fragment Para 1 <p>Para 2 <p>Para 3"},"parts":[{"template":{"target":{"wt":"code","href":"./Template:Code"},"params":{"lang":{"wt":"html"},"code":{"wt":"<p>Para 1 <p>Para 2 <p>Para 3"}},"i":0}}]}'><p>Para 1 <p>Para 2 <p>Para 3 is thus inferred to be equivalent to Para 1 </p><p>Para 2 </p><p>Para 3"},"parts":[{"template":{"target":{"wt":"code","href":"./Template:Code"},"params":{"lang":{"wt":"html"},"code":{"wt":"<p>Para 1 </p><p>Para 2 </p><p>Para 3"}},"i":0}}]}'><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 <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.

Overview

edit

Syntax

edit
\n\\overbrace{\n \\overbrace{\\mathtt{\\color{BrickRed}<\\!p\\ }\\color{Magenta}\\underbrace\\mathtt{class}_\\mathsf{\\color{Black}{Attribute \\atop name}}\\mathtt{= ''}\\!\\underbrace\\mathtt{paragraph}_\\mathsf{\\color{White}{Attr} \\atop \\color{Black}Attribute\\ value}''\\mathtt{\\color{BrickRed}>}}^\\mathsf{Start\\ tag}\n \\overbrace\\mathtt{\\color{Green}This\\ is\\ a\\ paragraph.}^\\mathsf{Content}\n \\overbrace\\mathtt{\\color{BrickRed}<\\!/p\\!>}^\\mathsf{End \\atop tag}\n}^\\mathsf{Element}\n</math>"}},"i":0}}]}'>
}}^\\mathsf{Start\\ tag}\n \\overbrace\\mathtt{\\color{Green}This\\ is\\ a\\ paragraph.}^\\mathsf{Content}\n \\overbrace\\mathtt{\\color{BrickRed}<\\!/p\\!>}^\\mathsf{End \\atop tag}\n}^\\mathsf{Element}\n"}}'><πš™Β πšŒπš•πšŠπšœπšœβŸAttributename=β€³πš™πšŠπš›πšŠπšπš›πšŠπš™πš‘βŸAttrAttributeΒ valueβ€³>βžπ–²π—π–Ίπ—‹π—Β π—π–Ίπ—€πšƒπš‘πš’πšœΒ πš’πšœΒ πšŠΒ πš™πšŠπš›πšŠπšπš›πšŠπš™πš‘.βžπ–’π—ˆπ—‡π—π–Ύπ—‡π—</πš™>⏞Endtagβžπ–€π—…π–Ύπ—†π–Ύπ—‡π—
Parts of an HTML container 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. For example, a paragraph, which is represented by the 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 end of the tag (not to be confused with the / at the \n"}}'><p lang="en-us">Paragraph in English</p>

Since HTML5, HTML allows the use of uppercase attribute names and omission of quotemarks.

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

edit

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:


View original on Wikipedia | Back | FazBrowse Home