In computing, an HTML element indicates structure in an HTML document and a way of hierarchically arranging content. More specifically, an HTML element is an SGML element that meets the requirements of one or more of the HTML Document Type Definitions (DTDs). These elements have properties: both attributes and content, as specified (both allowable and required) according to the appropriate HTML DTD (for example, the HTML 4.01 strict DTD). Elements may represent headings, paragraphs, hypertext links, lists, embedded media, and a variety of other structures.
Syntactically HTML elements are constructed with: 1) a start tag marking the beginning of an element; 2) any number of attributes (and their associated values); 3) some amount of content (characters and other elements)'; and 4) an end tag. Many HTML elements include attributes in their start tags, defining desired behavior or indicating additional element properties. The end tag is optional for many elements; in a minimal case, an empty element has no content and requires no end tag. There are a few elements that are not part of any official DTDs, yet are supported by some browsers and used by some web pages. Such elements may be ignored or displayed improperly on browsers not supporting them.
Informally, HTML elements are sometimes referred to as "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.
XHTML is the successor to HTML 4.01; XHTML 1.0 supports the same elements as HTML 4 and in most cases valid XHTML 1.0 documents will be valid or nearly valid HTML 4 documents. XHTML 1.0 migrates HTML from its SGML underpinnings to an XML foundation. Accordingly, the discussion of elements within this article focucses on the final SGML based HTML, version 4.01 (unless noted otherwise). However, to the extent the XHTML 1.01 elements remain similar the HTML 4.01 elements, the discussion remains applicable.
HTML elements are classified as either block-level or inline (in a line with the text). Block-level elements — such as headings, paragraphs, lists, or tables — are typically "larger" than inline elements and generally begin a new line. Block-level elements may generally contain other block-level elements or inline elements. Inline elements — such as hyperlinks, citations, quotations, or emphasized text — may contain only other inline elements or text. Some block-level elements can only contain specific block-level elements or even inline elements only.
A block-level element, such as a paragraph, is typically displayed as an independent "block" separated from other blocks by vertical space (margins). Inline elements generally occupy a line determined by its nearest block-level ancestor.
(See "The global structure of an HTML document")
Many HTML elements can be nested, or contained within other HTML elements:
You rock
Nesting can be more complex:
L'etat, c'est moi!
(Wikipedia).
Nesting may be arbitrarily deep, but the elements must be closed in the reverse order that they were opened for the code to remain valid (this pattern is known as Last in, first out).
Mary kissed Jimmy
Mary kissed Jimmy
Some block-level elements (e.g. paragraphs) may contain only inline elements, and some (e.g. forms, lists) must contain only block-level child elements, but most may contain either block-level or inline elements.
Root elements provide the containers enclosing all other HTML elements. Every HTML page has these elements. Even when these elements are omited the browser — or other HTML software — treats them as implied.
head element and one body element.
meta' for extensible specification of metadata. if the head tags are omitted the extant of the head may be inferred by other means. Some software may not behave as expected without explicit inclusion.
<html> and <head>, the tags themselves may be inferred by most software when not included explicitly.
These root elements are arranged as follows:
head element.
script element must occur,(though any number may occur), arranged in any order to suit the meaning and also typically the presentation of the documentt. The ins and del elements are also permissible within the body element when used as block level elements. The other block elements are: paragraph (p), heading (h1...h6), block quotation (bockquote), ordered list ((ol), unordered list (ul), definition list (dl), div (div), no script support (noscript), form (form), table (table), fieldset (fieldset), and address (address). No other HTML elements are valid within the body element.
title in different ways. Web browsers usually display it in the title bar when the window is open, and in the task bar when it is minimized. It may become the default filename when saving the page, Search engines' web crawlers may pay particular attention to the words used in the title element. The title element must not contain any nested tags (in other words it cannot contain any other elements). Only one title element is permitted in a document.
href and other links in the document. Must appear before any element that refers to an external resource. HTML permits only one base element for each document. The base element has attributes, but no contents.
head may contain any number of link elements. The link element has attributes, but no contents. A common use is to link to external stylesheets, using the form:
<link rel="stylesheet" type="text/css" href="url" title="description of style" />*
font elements. Deprecated in favor of stylesheets.
script tags and/or it may be in a separate resource whose URL is specified in script's optional src attribute. *
style tags and/or it may be in separate resources whose URLs are specified in @import directives such as:
<style> @import "url"; </style>. *
head. Though rarely used as a head element, this could potentially be used to extract foreign data, relevant to the document, and associate this data with the current document.
head elements and attributes. A special form is used to specify commands which should be sent over the HTTP protocol: the typical method of transporting HTML documents. For example:
<meta http-equiv="foo" content="bar" />
meta element is possibly the most diverse and complicated of all the elements. Consider the specification of a keyword meta element: However it accomplishes the task through a common protocol called key value coding. The element specifies two main attributes: a name (a key or property) and ithe associated cotnent (or value) for that name. Because the meanings associated with these properties may be ambigous, a third option attribute may be specified: schema. The scehma attribute provide a reference to an established semantic protocol for understanding the meanings of the names and associated values. For example
meta element identifies itself as containing a keyword. The keyword is "key word". And it uses the DC or Dublin Core scheme to define the meaning of the other attributes.
Inline elements cannot be placed directly inside the body element for valid HTML. They must be wholly nested within block-level elements (see block elements below).
blockquote below). Quote elements may be nested, By the specification, the author should not include quotation marks Rather quotation marks — including netsted quoatation marks — should be rendered through sttylesheet properties or the browser's default stylesheet. Practical concers due to browser non-compliance may force authors to find work-arounds. The cite attribute gives the source, and must be a fully qualified URI.
<q class='lengthy'>An inline quotation of significant length (say 25 words, for example) goes here...</q>.
abbr element.
Code snippet.
{vertical-align: sub} or {vertical-align: super}
<del>'d text. Typically rendered underlined: Inserted text.
ins and del elements may be used as a block elements: containing other block and inline elements. However, these elements must still remain wholly within their parent element to maintain a well-formed HTML document). For example deleting text from the middle of one paragraph across several other paragraph and ending in a final paragraph would need to use three separate del elements. Two del elements would be required as inline element to indicate the deletion of text in the first and last paragraphs, and a third, used as a block element, to indicate the deletion in the intervening paragraphs.
isindex element requires server side support for indexing documents. Visually presents a one-line text input for keyword entry. When submitted, the query string is appended to the current URL and the document is displayed with these keywords highlighted. Generally if the server supports this feature it will add the iisindex elements to documents without author intervention.
href attribute set to a URL; additionally the attribute title may be set to a hover box text, some informative text about the link:
name attribute set, which preceded by a number sign '#', and appended to the URL, acts as a link target (a "document fragment"), typically causing a Web browser to scroll directly to that point of the page. Any element can be made into an anchor by using the id attribute, so using <a name="foo"> is not necessary.
src attribute, the required alt provides alternative text in case the image cannot be displayed. Alt is intended as alternative text, although many browsers render it as a tooltip; the title attribute is the tooltip text.
type attribute. This may be in any MIME Type the webbrowser understands, such as an embedded page, code to be handled by a plug-in such as Flash, a Java applet, a sound file etc.
object element. Using attributes such as name and value, each <param/> sets a parameter for the object. Examples include width, height, font, background colour etc, depending what has been exposed in this way by the object's developers.
<embed>…</embed> (unofficial)
type attribute. Used for embedding Flash files, soundfiles etc. Not official; <object> is preferred.
<noembed>…</noembed> (unofficial)
<object> is now preferred.
<span>…</span>
id or class attribute, which can then be referenced from CSS or DOM call. Like most HTML elements, span also supports inline CSS in its optional style attribute).
Many HTML elements are designed for altering the semantic structure or meaning of a document. Some are block-level, but most are inline and can be included in the normal flow of text.
Creates a paragraph, perhaps the most common block level element.
cite attribute may give the source, and must be a fully qualified URI. The blockquote element is often misunderstood. It is an element meant to contain quotations that are themselves block level. In other words: to contain a complete paragraph or many paragraphs. In HTML strict DTDs inline elements are prohibited from blockquote elements. For quotations not containing block level elements see the quote (q) element.
<h1> for the highest-level heading (the major sections), <h2> for the next level down (sub-section), <h3> for a level below that, and so on. The lowest level heading is <h6>.
<h1> as large text in a different font, and <h6> as small bold-faced text, but this can be overridden with CSS. The heading elements are not intended merely for creating large or bold text: they describe something about the document's structure and organization. Some programs use them to generate outlines and tables of contents.
ol, the type attribute can be used to specify the kind of ordering, but CSS gives more control: {list-style-type: foo}. The default is Arabic numbering. For ul, CSS can be used to specify the list marker: {list-style-type: foo}. The default marker is a disc.
<ul>.
<ul> list, but badly supported. Deprecated in favor of <ul>.
<thead>, this section may be repeated by the user agent if the table is split across pages (in printing or other paged media)
}}
}}
<button> if possible (i.e. if the client supports it) which provides richer possibilities.
src tag.
size attribute specifies the default width of the input in character-widths. Maxlength sets the maximum number of characters the user can enter (which may be greater than size).
}}
}}
cols and rows attributes. Text in between the tags appears in the text area when the page is loaded.
<div>…</div>
id or class attribute, which can then be referenced from CSS or DOM calls. Like most HTML elements, div also supports inline CSS in its optional style attribute).
pre element signals that this 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: image (img), object (object), big font size (big), small font size (small), superscript (sup), and subscript (sub).
br to insert a new line within this element.
object element allows HTML authors to specify everything required by an object for its presentation by a user agent thus subsumes some of the tasks carried out by" iframe [http://www.w3.org/TR/1999/PR-html40-19990824/struct/objects.html#h-13.1
object element, an iframe (inline frame) element may be the "target" frame for links defined in other elements and it may be "selected" by a browser as the focus for printing, viewing HTML source etc.*
An HTML document may contain a header and a body or a header and a frameset, but not both. For frames the Frames DTD must be used.
rows and cols attributes.
src attribute appears inside.
<body> element with child elements that will appear in web browsers that don't support frames.
<body>, which embeds another HTML document. Alternatively, a similar effect can also be achieved using the <object> element. To embed a document within another document, authors may use either the IFRAME element or the OBJECT element, but the elements differ in some ways (World Wide Web Consortium *).
See also Framing (World Wide Web).
<b>…</b> and <i>…</i> are invalid in the current draft of XHTML2.0.
<div> or another element with centering defined using CSS.
{font-weight: bold}
{font-style: italic}
{font-size: larger}.
{font-size: smaller}{text-decoration: line-through}
{font-family: monospace}
{text-decoration: underline}
<font *>…</font> (deprecated)
color attribute, typeface with the face attribute, and absolute or relative size with the size attribute.
<font color="green">text</font> creates green text. See template:fontcolor.
<font color="#1f4099">text</font> creates text with hexadecimal color #1f4099.
<font size="4">text</font> creates text with size 4. Sizes are from 1 to 7. The standard size is 3, unless otherwise specified in the <body> or other tags.
<font size="+1">text</font> creates text with size 1 bigger than the standard.. <font size="-1">text</font> is opposite.
<font face="Courier">text</font> makes text with Courier font.
<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).
<font color="red"> corresponds to {color: red}
<font face="Courier"> corresponds to {font-family: Courier}
<blink>…</blink> (unofficial)
{text-decoration: blink}
<marquee>…</marquee> (unofficial)
<nobr>…</nobr> (unofficial)
{white-space: nowrap}
<!--…-->
</html>. A client should render none of its enclosed contents. The closing ">" is required. For compatibility with some pre-1995 browsers, SGML comments are sometimes used inside <style> or <script> tags, but this is not necessary and may in fact cause undesired effects.
Etiquetta de HTML | Elementi HTML | HTML žymė | Lijst van HTML-elementen | Tag | Элементы HTML | รายชื่อ HTML element
This article is licensed under the GNU Free Documentation License.
It uses material from the
"HTML element".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world