Content deleted Content added
Sophia Saiz (talk | contribs) Tags: Reverted Text added at end of page 2017 wikitext editor |
Untamed1910 (talk | contribs) m Reverted 1 edit by 2600:6C55:49F0:1650:CC15:F62C:2822:C56C (talk) to last revision by Bruce1ee |
||
(215 intermediate revisions by more than 100 users not shown) | |||
Line 1:
{{for|the usage of HTML on Wikipedia|H:HTML|selfref=y}}
{{Redirect2|nobr|Font color||NOBr|and|Font color (disambiguation)}}
▲{{short description|Individual component of an HTML document}}
{{Use American English|date=March 2018}}
{{Html series}}
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).{{Vague|date=February 2019}} 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.
==Concepts==
[[File:HTML element content categories.
===Elements vs. tags===
Line 96 ⟶ 97:
<p>P. Sherman<br>42 Wallaby Way<br>Sydney</p>
</syntaxhighlight>
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 <code>
<syntaxhighlight lang="html">
<p>P. Sherman<br />42 Wallaby Way<br />Sydney</p>
Line 165 ⟶ 166:
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.<ref>[[#WHATWGLS|WHATWGLS]]. § 15</ref>
The first Standard ([[HTML#
(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|XHTML 1.0 Strict]], but also includes the '''[[Ruby (annotation markup)|Ruby markup]]''' module.)<ref name="XHTML11">[[#XHTML11|XHTML 1.1]] §A</ref>
Line 178 ⟶ 179:
|year=2013
|publisher=[[W3C]]
}}</ref> This is often referred to as a [[separation of concerns]]. HTML is used to represent the structure or content of a document, its presentation remains the sole responsibility of [[CSS]] style sheets. A default [[
|title=Appendix D. Default style sheet for HTML 4
|work=Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification
Line 277 ⟶ 278:
* 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 <title> element only one time in a web page, and when we make another page then we will use again another <title> element with new title (
* [[Web search engine]]s' [[web crawler]]s may pay particular attention to the words used in the title.
The {{tag|title|o}} element must not contain other elements, only text. Only one {{tag|title|o}} element is permitted in a document.
Line 298 ⟶ 299:
* 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 '''
* 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 [[Document Type Definition|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.
Line 326 ⟶ 327:
==== Lists ====
{{glossary}}
{{anchor|dl}}{{term|term=dl |content= {{XMLElement|dl|Definition List}} }}
{{defn|1= {{redirect|Definition list|Wikipedia's article on lists of definitions|Glossary}}
A description list (a.k.a. [[association list]] or definition list)
}}
{{defn|<code>DL</code> existed in ''[[#HTMLTAGS|HTML Tags]]'', and was '''standardized''' in [[#HTML20|HTML 2.0]]; still current.}}
Line 431 ⟶ 432:
{{defn|'''Standardized''' in [[#HTML5|HTML 5.1]].}}
{{term|term=menu |content= {{XMLElement|menu|Menu
{{defn|1= HTML 2.0: A menu listing. Should be more compact than a {{tag|ul|o}} list.}}
{{defn|<code>MENU</code> existed in ''[[#HTMLTAGS|HTML Tags]]'', and was '''standardized''' in [[#HTML20|HTML 2.0]]; '''deprecated''' in [[#HTML401|HTML 4.0 Transitional]]; '''invalid''' in [[#HTML401|HTML 4.0 Strict]]; then redefined in [[#HTML5|HTML5]],
{{term|term=nav |content= {{XMLElement|nav|Navigation}} }}
Line 460 ⟶ 461:
===Inline elements===
Inline elements cannot be placed directly inside the {{code|lang=html|code=<body>}} element; they must be wholly nested within block-level elements.<ref>{{citation|url=http://www.w3.org/TR/html401/struct/global.html#h-7.5.1 |title=HTML 4.01 |publisher=
====Anchor====
{{for|
{{glossary}}
{{term|term=a |content= {{XMLElement|a|Anchor}} }}
{{defn|1= <p>An anchor element is called an anchor because web designers can use it to "anchor" a URL to some text on a web page. When users view the web page in a browser, they can click the text to activate the link and visit the page whose URL is in the link.<ref>{{cite book |last1= Tittel |first1= Ed |last2= Burmeister |first2= Mary C. |date= 2005 |title= HTML 4 for dummies |edition= 5th |publisher= Wiley |___location= Hoboken, New Jersey |isbn= 978-0-7645-8917-1 |page= 96 |url= https://archive.org/details/html4fordummies00titt_2/page/96/ |url-access= registration |access-date= 7 August 2022}}</ref></p>
<p>In HTML, an "anchor" can be either the {{em|origin}} (the [[anchor text]]) or the {{em|target}} (destination) end of a [[hyperlink]]. As an origin, setting the attribute <code>href</code>,<ref>{{cite web|url=http://www.w3.org/Provider/ServerWriter.html|title=ServerWriter -- /Provider|website=W3C}}</ref> creates a hyperlink; it can point to either another part of the document or another resource (e.g. a webpage) using an external [[Uniform Resource Locator|URL]]. As a target, setting the <code>name</code> or <code>id</code> [[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.</p>
<p>To illustrate: the header of a table of contents section on <samp>example.com</samp>'s homepage could be turned into a target by writing: {{code|lang=html|code=<h2><a name="contents">Table of contents</a></h2>}}.</p>
Line 486 ⟶ 487:
====Phrase elements====
Phrase elements are used for marking up phrases and adding structure or semantic meaning to text fragments. For example, the
=====General=====
Line 499 ⟶ 500:
{{defn|'''Standardized''' in [[#HTML401|HTML 4.0]]; still current, '''not supported''' in [[#HTML5|HTML5]]. Recommended replacement is the <code>abbr</code> tag.<ref>[https://www.w3schools.com/tags/tag_acronym.asp Acronym tag], acronym.</ref>}}
{{term|term=
{{defn|1= Inline definition of a single term.}}
{{defn|<code>DFN</code> existed in ''[[#HTMLDRAFT12|HTML Internet Draft 1.2]]'', and was fully '''standardized''' in [[#HTML32|HTML 3.2]]; still current.}}
{{term|term=em |content= {{XMLElement|em|Emphasis}} }}
{{defn|1=
{{defn|<code>EM</code> existed in ''[[#HTMLDRAFT12|HTML Internet Draft 1.2]]'', and was '''standardized''' in [[#HTML20|HTML 2.0]]; still current.}}
{{term|term=strong |content= {{XMLElement|strong|Importance}} }}
{{defn|1=
An [[voice browser|aural user agent]] may use different voices for emphasis.
Line 576 ⟶ 577:
{{defn|<code>S</code> was '''deprecated''' in [[#HTML401|HTML 4.0 Transitional]] (having not appeared in any previous standard), and was '''invalid''' in [[#HTML401|HTML 4.0 Strict]]. '''Reintroduced''' in [[#HTML5|HTML5]], which instead deprecated {{tag|strike|o}}.}}
{{term|term=big |content= {{XMLElement|big|Big|deprecated=1}} }}
{{defn|1= Increased font size (<big>bigger</big> text). Equivalent CSS: {{code|lang=css|code={ font-size: larger; } }}}}
{{defn|'''Standardized''' in [[#HTML32|HTML 3.2]]; '''not supported''' in [[#HTML5|HTML5]].}}
{{term|term=strike |content= {{XMLElement|strike|Strikethrough|deprecated=1}} }}
{{defn|1= Strike-through text (<s>Strikethrough</s>), (Equivalent CSS: {{code|lang=css|code={ text-decoration: line-through; } }})}}
{{defn|<code>STRIKE</code> was standardized in [[#HTML32|HTML 3.2]]; '''deprecated''' in [[#HTML401|HTML 4.0 Transitional]]; '''invalid''' in [[#HTML401|HTML 4.0 Strict]].}}
Line 586 ⟶ 587:
{{term|term=tt |content= {{XMLElement|tt|Teletype|deprecated=1}} }}
{{defn|1= [[non-proportional font|Fixed-width]] font ({{mono|typewriter-like}}<!-- DO NOT use actual deprecated markup in this page; use CSS to simulate its output.-->), also known as [[Teleprinter|teletype]], thus "tt". (Equivalent CSS: {{code|lang=css|code={ font-family: monospace; } }})}}
{{defn|<code>TT</code> existed in ''[[#HTMLDRAFT12|HTML Internet Draft 1.2]]'', and was '''Standardized''' in [[#HTML20|HTML 2.0]]; not supported<ref name="html5-tt-not-supported">{{citation|url=http://www.w3.org/TR/html5/obsolete.html#non-conforming-features |title=11 Obsolete features — HTML5 |publisher=
{{term|term=font |content= {{XMLElement|font|
{{defn|1= {{code|lang=html|code=<font [color=<var>color</var>] [size=<var>size</var>] [face=<var>face</var>]>...</font>}}
Line 717 ⟶ 718:
{{term|term=applet |content= {{XMLElement|applet|Java Applet|deprecated=xhtml}} }}
{{defn|1= Embeds a [[Java applet]] in the page. Deprecated in favor of {{tag|object|o}}, as it could only be used with Java applets, and had accessibility limitations.}}
{{defn|'''Standardized''' in [[#HTML32|HTML 3.2]]; '''deprecated''' in [[#HTML401|HTML 4.0 Transitional]]; '''invalid''' in [[#HTML401|HTML 4.0 Strict]]
{{term|term=area |content= {{XMLElement|area|Area|end=no}} }}
Line 724 ⟶ 725:
{{term|term=audio |content= {{XMLElement|audio|Audio}} }}
{{defn|1= Adds playable [[
{{defn|'''Standardized''' in [[#HTML5|HTML5]].}}
Line 734 ⟶ 735:
{{term|term=embed |content= {{XMLElement|embed|Embed}} }}
{{defn|1= Inserts a non-standard object (like applet) or external content (typically non-HTML) into the document.}}
{{defn|Deprecated in HTML 4 in favor of {{tag|object|o}}, but then was added back into the HTML5 specification<ref>[http://webdesign.about.com/od/htmltags/p/bltags_embed.htm Jennifer Kyrnin ] {{Webarchive|url=https://web.archive.org/web/20121102014318/http://webdesign.about.com/od/htmltags/p/bltags_embed.htm |date=2012-11-02 }} {{tag|embed|o}}</ref><ref>[https://www.w3schools.com/tags/tag_embed.asp W3Schools] about {{tag|embed|o}}</ref>}}
{{term|term=img |content= {{XMLElement|img|Image|end=no}} }}
Line 763 ⟶ 764:
{{term|term=video |content= {{XMLElement|video|Video}} }}
{{defn|1= Adds a playable [[
{{defn|'''Standardized''' in [[#HTML5|HTML5]].}}
{{glossary end}}
Line 949 ⟶ 950:
==Frames==
{{Main|
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,<ref>{{cite web|url=http://www.washington.edu/doit/are-frames-accessible|title=Are frames accessible?|quote=...frames do present additional usability challenges that are unique to users with disabilities, particularly those who use screen readers.}}</ref> 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 {{tag|iframe|o}} 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 ([[Plug-in (computing)|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 {{tag|head|o}} and a {{tag|body|o}} {{em|or}} a {{tag|head|o}} and a {{tag|frameset|o}}, but not both a {{tag|body|o}} and a {{tag|frameset|o}}. However, {{tag|iframe|o}} can be used in a normal document body.
Line 980 ⟶ 981:
In [[HTML]], '''<code>longdesc</code>''' is an attribute used within the {{tag|img|s}}, {{tag|frame|s}}, or {{tag|iframe|o}} elements. It is supposed to be a [[URL]]{{refn|group=note|Strictly an [[Internationalized resource identifier|IRI]], not a URL; although URLs are a subset of IRIs.}} to a document that provides a '''long description''' for the image, frame, or iframe in question.<ref>{{cite web|url=http://www.w3.org/TR/REC-html40/struct/objects.html|title=Objects, Images, and Applets|publisher=W3C|access-date=2008-12-20}}</ref> This attribute should contain a URL, {{em|not}} – as is commonly mistaken – the text of the description itself.
<code>longdesc</code> was designed to be used by [[screen reader]]s to display image information for computer users with [[accessibility]] issues, such as the blind or [[Visual_impairment |visually impaired]], and is widely implemented by both web browsers and screen readers.<ref>{{cite web|url=http://www.w3.org/html/wg/wiki/ChangeProposals/InstateLongdesc/Implementation|title=InState Longdesc|access-date=2011-09-05}}</ref> Some developers object that<ref>{{cite web|url=http://www.webaim.org/techniques/images/longdesc.php#longdesc|title=Creating Accessible Images|publisher=WebAim|access-date=2008-12-20}}</ref> 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 <code>longdesc</code>.<ref>{{citation|url=http://wiki.whatwg.org/wiki/Longdesc_usage |title=Longdesc usage - WHATWG Wiki |publisher=Wiki.whatwg.org |access-date=2012-03-26}}</ref> The publishing industry has responded, advocating the retention of <code>longdesc</code>.<ref>{{cite web|url=http://www.w3.org/Bugs/Public/show_bug.cgi?id=13461|title=Bug 13461 - Commentary on Issue #30 (longdesc) from the Association of American Publishers |access-date=2011-09-05}}</ref>
====Example====
Line 1,016 ⟶ 1,017:
{{term|term=xmp |content= {{XMLElement|xmp|HTML Example|deprecated=1}} }}
{{defn|1= This element displayed the text inside the tags in a monospace font and without interpreting the HTML. The [[#HTML20|HTML 2.0]] specification recommended rendering the element at 80 characters per line.}}
{{defn|'''Deprecated''' in [[#HTML32|HTML 3.2]]; '''obsolete''' in [[#HTML5|HTML5]].<ref>{{cite web|url=https://developer.mozilla.org/en-US/docs/Web/HTML/Element/xmp|title=<xmp>|website=MDN Web Docs|date=24 February 2023 }}</ref>}}
{{term|term=nextid |content= {{XMLElement|nextid|NeXT ID|deprecated=1|end=no|noslash=yes}} }}
Line 1,024 ⟶ 1,025:
==Non-standard elements==
{{Quote box
| width = 250px
| class = noprint
| quote = <div style="font-size: 100%; color:#FF00CC;">{{marquee|This is the new WikiPedia!}}</div>
| source = Example of marquee text from the [[first Wikipedia edit]] (accomplished via CSS; the <marquee> tag itself is deprecated and no longer works in most browsers)
}}
{{Quote box
| width = 250px
| class = noprint
| quote = {{blink|[[WP:UuU|UuU]]}}
| source = Example of blinking text (accomplished via CSS; the <blink> 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 [[Validator|valid]] code. They may not be supported in all user agents.
Line 1,030 ⟶ 1,041:
{{term|term=blink |content= {{XMLElement|blink|Blink|deprecated=1}} }}
{{defn|1= {{Main|Blink element}}
Causes text to blink. Introduced in imitation of the [[ANSI escape code]]s. Can be done with CSS where supported: {{code|lang=css|code={text-decoration: blink}
{{defn|{{code|lang=html|code=<blink>}} originated in [[Netscape Navigator]] and is mostly recognized by its descendants, including [[Firefox]]; '''deprecated''' or '''invalid''' in [[#HTML20|HTML 2.0]] and later. The replacement CSS tag, while standard, is not required to be supported.}}
Line 1,044 ⟶ 1,055:
{{term|term=nobr |content= {{XMLElement|nobr|No Break|deprecated=1}} }}
{{defn|1= Causes text to not break at end of line, preventing word wrap where text exceeds the width of the enclosing object. Adjacent text may break before and after it. Can be done with CSS: {{code|lang=css|code={white-space: nowrap;}
{{defn|{{code|lang=html|code=<nobr>}} is a proprietary element which is recognized by most browsers for compatibility reasons; '''deprecated''' or '''invalid''' in [[#HTML20|HTML 2.0]] and later.}}
Line 1,090 ⟶ 1,101:
===HTML standards===
;<span id="HTML20">HTML 2.0{{colon}}</span>
:{{cite
|last1=Berners-Lee |first1=Tim |author1-link=Tim Berners-Lee
|last2=Connolly |first2=Dan |author2-link=Dan Connolly (computer scientist)
Line 1,096 ⟶ 1,107:
|publisher=[[IETF]]
|date=November 1995
|rfc=1866
|access-date=2009-03-24}}
;<span id="HTML32">HTML 3.2{{colon}}</span>
Line 1,115 ⟶ 1,126:
|date=1999-12-24
|url= https://www.w3.org/TR/html4/
|access-date=2009-03-24}}
;<span id="XHTML10">XHTML 1.0{{colon}}</span>
:{{cite web
|title=XHTML 1.0: The Extensible HyperText Markup Language (Second Edition)
|version=Revised version
|publisher=[[W3C]]
|date=2002-08-01
|orig-
|url= https://www.w3.org/TR/xhtml1/
|access-date=2009-03-24}}
Line 1,135 ⟶ 1,145:
|publisher=[[W3C]]
|date=2010-11-23
|orig-
|url= https://www.w3.org/TR/xhtml11/
|access-date=2018-07-26}} ''(Superseded on 2018-03-27 by HTML 5.2.)''
Line 1,153 ⟶ 1,163:
|publisher=[[W3C]]
|date=2010-07-29
|orig-
|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 [[#HTML52|HTML 5.2]].)''
Line 1,170 ⟶ 1,180:
|publisher=[[W3C]]
|date=2017-12-14
|orig-
|url= https://www.w3.org/TR/html52/
|access-date=2018-07-26}} ''Supersedes all previous versions of HTML and XHTML, including [https://www.w3.org/TR/html51/ HTML 5.1].''
Line 1,208 ⟶ 1,218:
|access-date=2009-04-18}} ''(This is the final draft of HTML 3.0, which expired without being developed further.)''
;''<span id="HTMLTABLES">HTML Tables{{colon}}</span>''
:{{cite
|last=Raggett |first=Dave
|title=HTML Tables (RFC 1942)
|publisher=[[IETF]]
|date=May 1996
|rfc= 1942
|access-date = 2009-03-22}}
;<span id="XML10">XML 1.0{{colon}}</span>
Line 1,235 ⟶ 1,245:
|publisher=[[W3C]]
|date=2008-04-11
|orig-
|url= http://www.w3.org/TR/CSS1/
|access-date=2018-07-26}}
Line 1,248 ⟶ 1,258:
|publisher=[[W3C]]
|date=12 April 2016
|orig-
|url= https://www.w3.org/TR/CSS2/
|access-date=2018-07-26}}
;CSS 3 and 4{{colon}}
:{{cite web
|last1=Atkins |
|last2=Eternad |first2=Elika J.
|last3=Rivoal |first3=Florian
Line 1,274 ⟶ 1,284:
{{wikibooks | HyperText Markup Language | Tag List | all elements in HTML }}
* HTML 4.01 (Dec 24, 1999): [http://www.w3.org/TR/html401/index/elements.html elements] and [http://www.w3.org/TR/html401/index/attributes.html attributes]
* {{vanchor|HTML5}} (Oct 28, 2014): [http://www.w3.org/TR/html5/index.html elements and attributes]
[[Category:HTML tags]]
[[Category:Web 1.0]]
|