An HTML element is an individual component of an HTML document or web page, after which it has been described in the Document Object Model. HTML consists of an HTML node tree, like a text node. Each node can have the specified HTML attribute. Nodes can also have content, including nodes and other text. Many HTML nodes represent semantics or meaning. For example, & lt; title & gt;
node represents the title of the document.
Video HTML element
Konsep
Dokumen vs. DOM
HTML documents submitted as "documents". This is then parsed, which converts it into an internal representation of Document Object Model (DOM), inside a web browser.
Presentations by web browsers, such as screen rendering or access by JavaScript, are then performed on this internal model instead of the original document.
The original HTML document, and at the current lower level, is mostly invalid HTML and is full of syntax errors. The parsing process is also needed to "fix" this error, as best as it can. The resulting model is often not true (that is, it does not represent what was originally intended by careless coders), but will at least be valid, in accordance with HTML standards. A valid model is produced, no matter how bad "tag soup" is provided. Only in the rarest cases will the parser leave the parsing altogether.
"Elements" and "tags" are very confusing terms. HTML documents contain tags, but do not contain elements. Elements only generate after parsing steps, from these tags.
As generally understood, the position of the element is shown as include from the start tag, may include some child content, and is terminated by the end tag. This is the case for many, but not all, elements in an HTML document.
Because HTML is based on SGML, the parsing also depends on the use of DTDs, especially HTML DTDs such as for HTML 4.01. DTD determines which type of element is possible (ie determines the type of element used to compile HTML) and DTD also specifies a valid combination where they can appear in the document. This is part of a general SGML behavior in which only one valid structure is maybe (per DTD), it is not generally a requirement that the document explicitly states that structure. As a simple example,
& lt; p & gt; The 1 & lt; p & gt; The 2 & lt; p & gt; The 3
dengan demikian dapat disimpulkan menjadi setara dengan:
-
& lt; p & gt ; Para 1 & lt;/ p & gt; & lt; p & gt; Para 2 & lt;/ p & gt; & lt; p & gt; Para 3
(If one paragraph element can not contain another, every paragraph that is currently open must be closed before starting another.)
Because of this implied behavior, based on a combination of DTD and individual documents, it is not possible to deduce elements from the only document tag, but only by also using a conscious SGML or HTML aware parser, with knowledge of DTD.
SGML vs. XML
SGML is complex, which has limited its adoption and understanding extensively. XML was developed as a simpler alternative. XML is similar to SGML, which can also use the DTD mechanism to determine which elements are supported and combinations are allowed as document structures. Decomposition of XML is simpler. The relationship of the tag to the element is always an actual parsing of tags included in the document, without any implied closure that is part of SGML.
In Macro HTML can be formed as XML, either through XHTML or via HTML5, decomposition of document tags as a simplified DOM element. Once the DOM element is obtained, the behavior beyond that point (ie rendering the screen) is identical.
% block;
vs. box
Part of this CSS presentation behavior is the idea of ââ"box model". This is applied to elements considered CSS as a "block" element, set via CSS display span>: block ; declaration.
HTML also has a similar concept, albeit different, and both are very often confused. % block;
and % inline;
is a group in the HTML DTD that groups elements as "block level" or "inline". This is used to determine their nested behavior: block-level elements can not be placed into an inline context. This behavior can not be changed; it was fixed in DTD. Blocks and inline elements have appropriate and different CSS behaviors attached to them by default, including the relevance of the box model for certain element types.
Note that this CSS behavior can, and often, be changed from the default. List with % block element;
and is presented as a block element by default. However, it is very common to set this with CSS to be displayed as an inline list. Maps HTML element
Overview
Syntax
In HTML syntax, most elements are written with the start tag and end tags, with content in between. The HTML tag consists of an element name, surrounded by angle brackets. The end tag also has a slash after the opening corner bracket, to distinguish it from the start tag. For example, a paragraph, represented by
However, not all of these elements require end tags, or even start tags, to be present. Some elements, called void elements or blank elements , have no end tags. A common example is
When using XHTML DTD, it is necessary to open and close elements with a single tag. To specify that it is an empty element, a /
is included in end of the tag (not to be confused with /
in start of the closing tag).
The HTML attribute is specified inside the start tag. For example, & lt; title & gt;
attribute in the opening tag. This will be written as:
There are several types of HTML elements: empty elements, raw text elements, and normal elements.
Hollow elements have only start tags, which contain any HTML attributes. They may not contain children, such as text or other elements. Often they place holders for elements that reference external files, such as images ( & lt; img /& gt;
) element. Attributes included in the element will point to the external file in question. Another example of an empty element is & lt; link /& gt;
element, the syntax is:
This is & lt; link /& gt;
element points the browser to a style sheet to use when presenting HTML documents to users. Note that in the HTML syntax, the attribute should not be cited if it only consists of several characters: letters, numbers, minus signs, and full stop points. When using XML syntax (XHTML), on the other hand, all attributes must be quoted, and trailing slashes are required before the last corner brackets:
The raw text element is constructed with:
- a start tag (
& lt; tag & gt;
) marks the start of an element, which can incorporate a number of HTML attributes; - some amount of text content , but no element (all tags, regardless of ending tag applicable, will be interpreted as content);
- the end tag, where element name starts with a slash:
& lt ;/ tag & gt;
. In some versions of HTML, the end tag is optional for some elements. End tag required in XHTML.
Normal elements typically have a start tag and a end tag, though for some elements, the end tag, or both tags, can be ignored. It's built in the same way:
- a start tag (
& lt; tag & gt;
) marks the start of an element, which can incorporate a number of HTML attributes; - some amount of content , including text and other elements;
- the end tag, where element name starts with a slash:
& lt ;/ tag & gt;
.
The HTML attribute specifies the desired behavior or shows additional element properties. Most attributes require value . In HTML, values ââcan be left without quotes if they do not include spaces ( name = value
), or can be quoted with single or double quotes ( name = 'value'
or < code> name = "value" ). In XML, the quotes are required. The Boolean attribute, on the other hand, does not require a value to be specified. An example is checked
for checkboxes:
In XML syntax, the name should be repeated as the value:
Informally, HTML elements are sometimes referred to as "tags" (examples of synecdoche), although many prefer the term tag to strictly refer to markup that limits the start and end of the element.
Elements (and attributes) names can be written in a combination of uppercase or small in HTML, but should be in lowercase in XHTML. The canonical form is capitalized to HTML 4, and is used in HTML specifications, but in recent years, lowercase has become more common.
Standard elements
The HTML element is 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 (eg 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 display improperly.
In 1998, XML (simplified form of SGML) introduced a mechanism to allow anyone to develop their own elements and combine them in XHTML documents, for use with XML-aware user agents.
Furthermore, HTML 4.01 is rewritten in XML-compatible form, XHTML 1.0 ( eXtensible HTML ). The elements in each are identical, and in most cases valid XHTML 1.0 documents will apply or almost apply HTML 4.01 documents. This article primarily focuses on real HTML, unless otherwise specified; However, it still applies to XHTML. See HTML for a discussion of the small differences between the two.
The element status
Because of the first version of HTML, some elements have become outdated, and obsolete in the later standard, or not appearing at all, in which case they are invalid (and will be found invalid , and may not be displayed, by validating the user agent).
Currently, element status is complicated by the presence of three types of HTML 4.01/XHTML 1.0 DTD:
- Transitions , which contain unused elements, but intended to provide a transition period in which authors can update their practices;
- Frameset , which is a transitional DTD version which also allows authors to write frameset documents;
- Strict , which is the current HTML form (in 1999).
The first standard (HTML 2.0) contains four unused elements, one of which is invalid in HTML 3.2. All four are invalid in HTML 4.01 Transition, which also no longer uses ten more elements. All of this, plus the other two, are not valid in HTML 4.01 Strict. While the frame elements are still up-to-date in terms of being present in the Transitional and Frameset DTDs, there are no plans to preserve them in future standards, as their functions have been replaced, and they are very problematic for user accessibility.
(Actually, the latest XHTML standard, XHTML 1.1 (2001), does not include frames at all, it's roughly equivalent to XHTML 1.0 Strict, but also includes the Ruby markup module. )
A common source of confusion is the loose use of obsolete to refer to invalid and invalid status, and to expected elements no longer used in the future.
Content vs. presentation and behavior
Since HTML 4, HTML has increasingly focused on separating content (visible text and images) from presentations (such as color, font size, and layout). This is often referred to as the separation of anxiety. HTML is used to represent the structure or contents of a document, its presentation remains the responsibility of the CSS style sheet. The standard style sheet is recommended as part of the CSS standard, providing a default render for HTML.
Behavior (interactivity) is also stored separately from the content, and handled by the script. Images are contained in separate graphical files, separate from the text, although they can also be considered part of the page content.
Separation of concerns allows documents to be presented by different user agents according to their purpose and capabilities. For example, the user agent can select the appropriate style sheet to present the document by displaying it on the monitor, printing on paper, or to specify speech characteristics in the audio user agent only. The structural and semantic functions of the markup remain identical in each case.
Historically, user agents do not always support this feature. In the 1990s, as a stop-stopping presentation element (such as & lt ; i & gt;
) are added to HTML, at the cost of creating problems for interoperability and user accessibility. These are now considered outdated and have been replaced by style-based designs; most presentational elements are now no longer used.
External image file combined with & lt; object & gt;
element. (With XHTML, the SVG language can also be used to write graphics within documents, although linking to external SVG files is generally simpler.) Where images are not completely decorative, HTML allows replacement content with the same semantic value to be reserved for visual-user agents.
HTML documents can also be extended through the use of scripts to provide additional behavior beyond the capabilities of hyperlinks and HTML forms.
Element & lt; style & gt;
and
& lt; script & gt;
and & lt; style & gt;
can link to a shared external document, or contain embedded instructions. (Link & lt; & gt;
element can also be used to associate style sheets.) & lt; noscript & gt;
element provides alternative content if appropriate; however, this can only be used as a block level element.
Document structure elements
Head document element
href
and other links in the document. Must appear before any elements that refer to external resources. HTML only allows one & lt; base & gt;
element for each document. BASE
is mentioned in HTML Tags ; standard in HTML 2.0; still smooth.
& lt; font & gt;
element. No longer supports style sheets.
& lt; isindex /& gt; (deprecated)
& lt; isindex & gt;
can appear on the document head or on the body, but only once in the document. View Form.
& lt; head & gt;
element can contain any number of & lt; link & gt;
element. Link & lt; & gt;
element has an HTML attribute, but it has no content. LINK
is in HTML Internet Draft 1.2 , and is standardized in HTML 2.0; still smooth.
& lt; meta âââ ⬠<â ⬠& gt;
element specifies an associative key value pair. In general, meta elements convey hidden information about documents. Some meta tags can be used, all of which must be nested in the head element. Specific purpose of each & lt; meta âââ ⬠<â ⬠& gt;
element can specify HTTP headers that should be sent by the web server before the actual content. For example, & lt; meta http-equiv = "foo" content = "bar" & gt;
specifies that the page should be presented with an HTTP header called foo
that has a value of bar
. & lt; meta âââ ⬠<â ⬠& gt;
element specifies the name
and the associated content
HTML attribute that describes aspects of the HTML page. To prevent possible ambiguity, an optional third attribute, the
scheme, can be given to define a semantic framework that defines the key meaning and its value. For example, in & lt; meta ââspan> = "foo" content span> = "bar" schematics = "DC" & gt;
style & lt; meta âââ ⬠<â ⬠& gt; The
element identifies itself as containing the foo
element, with a value of bar
, from the DC or Dublin Core resource description template.
src
. It can also be used in document bodies to dynamically generate either block or inline content.
@ import
directives from form:
& lt; title & gt;
elements are allowed in the document.
Document body element
In a visual browser, displayable elements can be displayed as blocks or inline . While all elements are part of the document order, the blocking element appears in the parent element:
- as a rectangular object that does not penetrate the line;
- with block margins, properties of width and height that can be set independently of the surrounding elements.
In contrast, inline elements are treated as part of a document text stream; they can not have specified margins, widths or heights, and make line breaks.
Block elements
The block element, or block level element, has a rectangular structure. By default, these elements will reach the width of the parent element, and thus will not allow other elements to occupy the same horizontal space when placed.
The block element's rectangular structure is often referred to as a box model, and consists of several parts. Each element contains the following:
- content element is the actual text (or other media) placed between the opening tag and the closing element.
- padding element is the space around that content, which is still part of the element. Padding is physically part of an element, and should not be used to create white space between two elements. Any background style assigned to an element, such as a background image or color, will be visible in padding. Increasing the size of the element padding increases the amount of space this element needs.
- The boundary of the element is the absolute end of an element, and extends around that element. Border thickness increases element size.
- the margin of an element is the white space surrounding an element. Content, padding and other boundary elements will not be allowed into this area, unless forced to do so by some advanced CSS placements. Using most standard DTDs, the margins on the left and right of different elements will push each other. Margin at the top or bottom of the element, on the other hand, will not accumulate, or will blend. This means that the white space between these elements will be as big as the larger margin between them.
The above section only refers to the detailed implementation of CSS rendering and has no relevance to the HTML element itself.
Basic text
P
ada di Tag HTML , dan distandardisasi dalam HTML 2.0; masih lancar.
& lt; h5 & gt; ... & lt;/h5 & gt;
& lt; h6 & gt; ... & lt;/h6 & gt;
h1
membatasi heading level tertinggi, h2
level berikutnya ke bawah (sub-bagian), h3
untuk level di bawahnya, dan seterusnya ke h6
. Mereka kadang-kadang disebut secara kolektif sebagai tag h n
, n yang berarti salah satu dari level heading yang tersedia. Daftar
DL
is in HTML Tags , and are standardized in HTML 2.0; still smooth.
DT
is in HTML Tags , and are standardized in HTML 2.0; still smooth.
DD
is in HTML Tags , and are standardized in HTML 2.0; still smooth.
type
attribute can be used to determine the type of marker used in the list, but the style sheet gives more control. The default is Arabic numbering. CSS: list-style-list: foo
. HTML attribute: & lt; ol type = " foo " & gt;
, in either case, replace foo
with one of the following:
A
for A, B, C... a
for a, b, c... I
for I, II, III... i
for me, ii, iii... 1
for 1, 2, 3... OL
exists in HTML Internet Draft 1.2 , and is standardized in HTML 2.0; still smooth.
list-style-list: foo
. The default marker type is disc
, the other values ââare square
, circle
and none
. UL
is in HTML Tags , and are standardized in HTML 2.0; still smooth.
ol
) atau tidak diurut ( ul
). LI
ada di Tag HTML , dan distandardisasi dalam HTML 2.0; masih lancar.
DIR
is in HTML Tags , and are standardized in HTML 2.0; is not used anymore in HTML 4.0 Transitions; invalid in HTML 4.0 Strict. Other block elements
ADDRESS
is in HTML Tags , and are standardized in HTML 2.0; still smooth.
cite
attribute can provide the source, and must be a fully qualified Unified Resource Identifier. q & gt;
) element. BLOCKQUOTE
is in HTML Internet Draft 1.2 , and is standardized in HTML 2.0; still current. See blockquote element for more information.
figcaption
.
MENU
is in HTML Tags , and are standardized in HTML 2.0; is not used anymore in HTML 4.0 Transitions; invalid in HTML 4.0 Strict; but then redefined in HTML5.
pre
, whitespace must be rendered as authored. (With CSS properties: : /span> pre ; font-family : monospace ;} , other elements can be presented in the same way.) This element can contain any inline elements except: image ( IMG
), object ( OBJECT
), large font size ( BIG
), lowercase size ( SMALL
), superscript ( SUP
), and subscript ( SUB
). PRE
is in HTML Internet Draft 1.2 , and is standardized in HTML 2.0; still smooth.
& lt; div & gt;
in this case is only used to load parts of the page, defined by the W3C as a group of content with a similar theme.
SCRIPT
is not a block or an inline element; by itself should not be displayed at all, but can contain instructions to dynamically generate either block or inline content. Inline elements
Inline elements can not be placed directly inside & lt; body & gt;
element; they must be fully nested within block level elements.
Anchor
href
attribute, the anchor becomes a hyperlink to another part of the document or other resource (such as a web page) using an external URL. As an alternative (and sometimes simultaneously), with the set of name
or id
HTML attributes, the element becomes target . Uniform Resource Locator can link to this target through fragment identifiers. In HTML5, each element can now be made into a target by using the id
attribute, so use & lt; a name = "foo" & gt; ... & lt;/ a & gt;
is not required, although how to add this anchor continues to work. example.com
can be converted into targets by writing
= Table of contents =
& lt; a href = "http://example.com#contents" & gt; view content & lt;/ a & gt;
& lt; a href = "content #" & gt; , above & lt;/ a & gt;
& lt; title & gt;
can be set to provide brief information about links:
& lt; a href = "URL" title = "additional information" & gt; link text & lt;/ a & gt;
A
is in HTML Tags , and are standardized in HTML 2.0; still smooth. Phrase elements
General
& lt; akronim & gt; ... & lt;/acronym & gt; (tidak lagi digunakan)
& lt; abbr < span> & gt;
elemen, tetapi tandai akronim:
DFN
ada di HTML Internet Draft 1.2 , dan sepenuhnya terstandar dalam HTML 3.2; masih lancar.
EM
is in HTML Internet Draft 1.2 , and is standardized in HTML 2.0; still smooth.
STRONG
is in HTML Internet Draft 1.2 , and is standardized in HTML 2.0; still smooth. Elements of a computer phrase
These elements are particularly useful for documenting the development of computer code and user interaction through source code differentiation ( & lt; code & gt;
), the source code variable ( & lt; var & gt;
), user input (style & lt; kbd & gt;
), and the terminal output span> ).
Source of the article : Wikipedia