Cannabis Ruderalis

Content deleted Content added
 
(233 intermediate revisions by more than 100 users not shown)
Line 1: Line 1:
{{Short description|Usage of HTML tags with MediaWiki}}
{{shortcut|H:HTML|WP:HTML}}
<noinclude>{{pp-semi-indef|small=yes}}</noinclude>
{{Wikipedia how to}}
{{Redirect|WP:HTML|general information about the default markup language on Wikipedia|Wikipedia:HTML5}}
{{Locutions pages header}}
{{Wikipedia how to|H:HTML|WP:HTML}}

{{Wiki markup}}
{{Wiki markup}}
{{HTML}}
{{HTML}}


The MediaWiki software, that drives Wikipedia, allows the use of a subset of [[HTML5]] [[HTML element|element]]s, or tags and their [[HTML attribute|attribute]]s, for presentation formatting.{{r|sanitizer}} But most HTML can be included by using equivalent [[Help:Wiki markup|wiki markup]] or [[Help:Template|templates]]; these are ''preferred'' within articles, as they are simpler for most editors, and less intrusive in the editing window. But HTML is useful outside of articles, for example for formatting within templates. For help with Cascading Style Sheet use within Wikipedia see [[Help:Cascading Style Sheets]].
The [[MediaWiki]] software, which drives Wikipedia, allows the use of a subset of [[HTML 5]] [[HTML element|elements]], or tags and their [[HTML attribute|attributes]], for presentation formatting.{{r|sanitizer}} But most HTML can be included by using equivalent [[Help:Wiki markup|wiki markup]] or [[Help:Template|templates]]; these are generally preferred within articles, as they are sometimes simpler for most editors and less intrusive in the editing window; but [[Wikipedia:Manual_of_Style#Keep_markup_simple|Wikipedia's Manual of Style]] recommends their use in certain cases. (See [[Help:Wikitext]] for wiki equivalents to HTML tags not otherwise discussed below.) And HTML is useful outside of articles, for example for formatting within templates. For help with Cascading Style Sheet use within Wikipedia see [[Help:Cascading Style Sheets]].


Some tags look like HTML, but are actually MediaWiki [[Help:HTML in wikitext#Parser and extension tags|parser and extension tags]], and so are really wiki markup. HTML in pages can be checked for HTML5 compliance by using [[Help:HTML_in_wikitext#Validation|validation]].
Some tags look like HTML, but are actually MediaWiki [[#Parser and extension tags|parser and extension tags]], and so are really wiki markup. HTML in pages can be checked for HTML5 compliance by using [[#Validation|validation]]. Some elements and attributes are supported by MediaWiki and browsers, but have been [[Wikipedia:HTML5|deprecated by HTML5]], and therefore should no longer be used.


{{TOC limit|3}}
==Tutorials==

== Tutorials ==
This help page gives only an overview of allowed markup. For further assistance and detailed specifications:
This help page gives only an overview of allowed markup. For further assistance and detailed specifications:
* [http://www.w3schools.com/html/html5_intro.asp HTML5 Introduction] at w3schools.com


* [https://developer.mozilla.org/en-US/docs/Learn/HTML HTML5 Introduction] at developer.mozilla.org
==Attributes==
* [https://www.w3schools.com/html/default.asp HTML5 Introduction] at w3schools.com

== Attributes ==
[[HTML attribute]]s provide additional information about an element and are always specified in the start tag. They are formatted as a name/value pair like <code>name="value"</code>.
[[HTML attribute]]s provide additional information about an element and are always specified in the start tag. They are formatted as a name/value pair like <code>name="value"</code>.


Global attributes apply to all tags. Attributes not listed here are not allowed by MediaWiki{{r|sanitizer}}:
Global attributes apply to all tags. Attributes not listed here are not allowed by MediaWiki{{r|sanitizer}}:
* <code>class</code>: one or more classifications to which the element belongs. See [[Wikipedia:Catalogue of CSS classes]].
* <code>class</code>: one or more classifications to which the element belongs. See [[Wikipedia:Catalogue of CSS classes]].
* <code>dir</code>: text direction— "<code>ltr</code>" (left-to-right), "<code>rtl</code>" (right-to-left) or "<code>auto</code>".
* <code>dir</code>: text direction— <code>"ltr"</code> (left-to-right), <code>"rtl"</code> (right-to-left) or <code>"auto"</code>.
* <code>id</code>: unique identifier for the element.
* <code>id</code>: unique identifier for the element.
* <code>lang</code>: primary language for the contents of the element per [[BCP 47]]. The MediaWiki software automatically adds the <code>xml:lang</code> attribute whenever <code>lang</code> is defined, but <code>xml:lang</code> will no longer be passed when included as a separate attribute.
* <code>lang</code>: primary language for the contents of the element per [[BCP 47]].
* <code>style</code>: applies CSS styling to the contents of the element.
* <code>style</code>: applies CSS styling to the contents of the element.
* <code>title</code>: advisory information associated with the element.
* <code>title</code>: advisory information associated with the element.
Line 42: Line 50:


{{markup
{{markup
|<nowiki>This is <span style="color:red">red</span> text.</nowiki>
|<syntaxhighlight lang="html">This is <span style="color:red;">red</span> text.</syntaxhighlight>
|2=This is <span style="color:red">red</span> text.
|2=This is <span style="color:red;">red</span> text.
}}
}}


Line 55: Line 63:
* Prepends space if there are attributes.
* Prepends space if there are attributes.


==Elements==
== Elements ==
These [[HTML element]]s are supported by the MediaWiki software. This section gives a brief overview of the HTML element, an example, relevant wikimarkup and templates.
These [[HTML element]]s are supported by the MediaWiki software. This section gives a brief overview of the HTML element, an example, relevant wikimarkup and templates.


===Basic===
=== Basic ===


====h1, h2, h3, h4, h5, h6====
==== h1, h2, h3, h4, h5, h6 ====
{{see|Help:Section|MOS:HEAD}}
{{see|Help:Section|MOS:HEAD}}
The {{tag|h1}} through {{tag|h6}} tags are headings for the sections with which they are associated. {{tag|h1|o}} is used for the article title. Headings are styled through CSS and added to the page's [[Help:table of contents|table of contents]].
The {{tag|h1}} through {{tag|h6}} tags are headings for the sections with which they are associated. {{tag|h1|o}} is used for the article title. Headings are [[Help:Cascading Style Sheets#Wiki headings|styled through CSS]] and added to the page's [[Help:table of contents|table of contents]].


{{markup
{{markup
Line 80: Line 88:


Wikimarkup: surround the text with the appropriate number of equal signs. Headers formatted with wikimarkup add an [edit] link.
Wikimarkup: surround the text with the appropriate number of equal signs. Headers formatted with wikimarkup add an [edit] link.
<section begin=WIKI_section />
<section begin="WIKI_section" />
{{markup
{{markup
|<nowiki>= Heading 1 =
|<nowiki>= Heading 1 =
Line 95: Line 103:
{{fake heading|sub=6|Heading 6}}
{{fake heading|sub=6|Heading 6}}
}}
}}
<section end=WIKI_section />
<section end="WIKI_section" />
Wiki headers use the following default CSS:
<section begin=HTML_section />
{| class="wikitable"
|-
! Wikimarkup !! [[HTML]] !! Style
|-
| {{nowrap|1=<code>= Heading =</code>}} || {{tag|h1|o}} || color: #000000; background: none; overflow: hidden; page-break-after: avoid; font-size: 1.8em; font-family: Georgia,Times,serif; margin-top: 1em; margin-bottom: 0.25em; line-height: 1.3; padding: 0; border-bottom: 1px solid #AAAAAA;
|-
| {{nowrap|1=<code>== Heading ==</code>}} || {{tag|h2|o}} || color: #000000; background: none; overflow: hidden; page-break-after: avoid; font-size: 1.5em; font-family: Georgia,Times,serif; margin-top: 1em; margin-bottom: 0.25em; line-height: 1.3; padding: 0; border-bottom: 1px solid #AAAAAA;
|-
| {{nowrap|1=<code>=== Heading ===</code>}} || {{tag|h3|o}} || color: #000000; background: none; overflow: hidden; page-break-after: avoid; font-size: 1.17em; font-weight: bold; margin-top: 0.3em; margin-bottom: 0; line-height: 1.6; padding-top: 0.5em; padding-bottom: 0;
|-
| {{nowrap|1=<code>==== Heading ====</code>}} || {{tag|h4|o}} || color: #000000; background: none; overflow: hidden; page-break-after: avoid; font-size: 100%; font-weight: bold; margin-top: 0.3em; margin-bottom: 0; line-height: 1.6; padding-top: 0.5em; padding-bottom: 0;
|-
| {{nowrap|1=<code>===== Heading =====</code>}} || {{tag|h5|o}} || color: #000000; background: none; overflow: hidden; page-break-after: avoid; font-size: 100%; font-weight: bold; margin-top: 0.3em; margin-bottom: 0; line-height: 1.6; padding-top: 0.5em; padding-bottom: 0;
|-
| {{nowrap|1=<code>====== Heading ======</code>}} || {{tag|h6|o}} || color: #000000; background: none; overflow: hidden; page-break-after: avoid; font-size: 100%; font-weight: bold; margin-top: 0.3em; margin-bottom: 0; line-height: 1.6; padding-top: 0.5em; padding-bottom: 0;
|-
|}
<section end=HTML_section />
Templates: {{tl|fake heading}} for use in documentation


Templates: {{tlx|fake heading}} for use in documentation
====p====

==== p ====
{{tag|p}} tag places content into a separate paragraph.
{{tag|p}} tag places content into a separate paragraph.


Line 137: Line 126:
}}
}}


{{tag|p}} is especially useful in lists, for list items with multiple paragraphs:
====br====

{{see|Wikipedia:Line-break handling|Wikipedia:Don't use line breaks}}
{{markup|<syntaxhighlight lang="tid">
{{tag|br|o}} or {{tag|br|s}} inserts a line break. Both versions of the break are supported by HTML5. {{tag|br|c}} is invalid.
* <p>This is a paragraph.</p><p>This is another paragraph in the same item.</p>
* This is a different item.</syntaxhighlight>
|
* <p>This is a paragraph.</p><p>This is another paragraph in the same item.</p>
* This is a different item.}}

Note that the closing tag {{tag|p|c}} is not strictly necessary for MediaWiki installations that output HTML 5 (such as Wikipedia).

==== br ====
{{see|Help:Line-break handling#&lt;br&gt;| Wikipedia:Don't use line breaks}}
{{tag|br|o}} inserts a line break. See [[H:BR]] for the other 4 versions that the [[MediaWiki]] software converts to {{tag|br|s}} in the HTML that browsers read.


{{markup
{{markup
Line 147: Line 147:


Templates:
Templates:
* {{tl|break}} adds multiple line breaks.
* {{tlx|break}} adds multiple line breaks.
* {{tl|crlf2}} adds adds a true carriage return and line feed.
* {{tlx|crlf2}} adds a true carriage return and line feed.
* {{tl|-}} adds a break with styling to clear floating elements.
* {{tlx|clear}} adds a break with styling to clear floating elements.
* {{tl|plainlist}} creates an unbulleted list.
* {{tlx|plainlist}} creates an unbulleted list.


====hr====
==== hr ====
{{see|WP:LINE}}
{{see|WP:LINE}}
{{tag|hr|o}} represents a paragraph-level thematic break and presents as a horizontal rule.
{{tag|hr|o}} or {{tag|hr|s}} represents a paragraph-level thematic break and presents as a horizontal rule.


{{markup
{{markup
|<nowiki><hr></nowiki>
|<nowiki><hr /></nowiki>
|<hr>
|<hr />
}}
}}


Line 168: Line 168:
}}
}}


Templates: {{tl|hr}}
Templates: {{tlx|hr}}


====comment====
==== Comments ====
{{see|WP:COMMENT}}
{{see|WP:COMMENT}}
{{tag|!--}} formats the enclosed text as a hidden comment.
{{tag|!--}} formats the enclosed text as a hidden comment.
Line 179: Line 179:
}}
}}


Be careful with spacing around comments. Surrounding a comment with blank lines will result in a blank paragraph, perceived as an extra two blank lines:
===Formatting===


{{markup|<nowiki>Content line 1
====abbr====

{{tag|abbr}} creates a tooltip to define an abbreviation or acronym that is displayed on mouse-over.
<!-- Comment -->

Content line 2</nowiki>|Content line 1

<!-- Comment -->

Content line 2}}

=== Formatting ===

==== abbr ====
{{tag|abbr}} creates a [[Wikipedia:Tooltips|tooltip]] to define an abbreviation or acronym that is displayed on mouse-over.


{{markup
{{markup
Line 189: Line 201:
}}
}}


Templates: {{tlx|abbr}}
Support: not supported by IE6 or IE7.

Templates: {{tl|abbr}}; supports Unicode display


====b====
==== b ====
{{see|MOS:BOLD}}
{{see|MOS:BOLD}}
{{tag|b}} formats text stylistically offset from other text (bold) without conveying extra importance.
{{tag|b}} formats text stylistically offset from other text (bold) without conveying extra importance.
Line 209: Line 219:
}}
}}


====bdi====
==== bdi ====


{{tag|bdi}} isolates the content from the surrounding text-direction settings.
{{tag|bdi}} isolates the content from the surrounding text-direction settings.
Line 224: Line 234:
Support: Firefox, Chrome
Support: Firefox, Chrome


====bdo====
==== bdo ====
{{tag|bdo}} specifies the text direction.
{{tag|bdo}} specifies the text direction.


Attributes and values:
Attributes and values:
* <code>dir</code> Specifies the text direction.
* <code>dir</code> Specifies the text direction.
** <code>ltr</code>
** <code>ltr</code>
** <code>rtl</code>
** <code>rtl</code>
Line 237: Line 247:
}}
}}


====blockquote====
==== blockquote ====
{{see|MOS:QUOTE}}
{{see|MOS:QUOTE}}
{{tag|blockquote}} presents text in an offset block.
{{tag|blockquote}} presents text in an offset block.
Line 246: Line 256:
}}
}}


Templates: {{tl|quote}}; supports pre-formatted attribution and source parameters. For other specialized quotation templates, see [[:Category:Quotation templates]].
Templates: {{tlx|quote}}; supports pre-formatted attribution and source parameters. For other specialized quotation templates, see [[:Category:Quotation templates]].


====cite====
==== cite ====
{{tag|cite}} contains the title of a work and by default is formatted in italics. This is a new definition in HTML5— in the previous XML implementation {{tag|cite|o}} was used to contain a citation or a reference to other sources.
{{tag|cite}} contains the title of a work. This is a new definition in HTML5— in the previous XML implementation {{tag|cite|o}} was used to contain a citation or a reference to other sources. No formatting is applied when this tag is used.


{{markup
{{markup
Line 256: Line 266:
}}
}}


{{tag|cite}} is generally not used directly in Wikipedia articles, and is often misused; see [[Wikipedia:HTML 5#cite]] for replacement instructions.
====code====

{{tag|code}} formats a section of computer code. MediaWiki applies CSS styling to display {{tag|code|o}} in a monospace font.
==== code ====
{{tag|code}} formats a section of computer code. Styled with [[Cascading Style Sheets|CSS]] through {{MediaWiki source|mediawiki.skinning/elements.less}} as a black [[Monospaced font|monospaced]] typeface with a grey background (#F8F9FA) and border (#EAECF0).


{{markup
{{markup
|<nowiki><code>HyperText Markup Language</code></nowiki>
|<nowiki>use <code>this code</code></nowiki>
|<code>HyperText Markup Language</code>
|use <code>this code</code>
|col2=Renders as<ref name="white bgcolor">For the table cell a white background color was chosen here for a better display of the light gray background.</ref>
|col2style=background-color:#fff;
}}
}}


Templates: {{tl|code}} uses {{xtag|syntaxhighlight}}.
Templates: {{tlx|code}} uses {{xtag|syntaxhighlight}}. See the "See also" section at the template page for additional code-markup templates.


See {{section link||samp}} and {{section link||kbd}} on this page for semantic markup of output and input, respectively.
====data====

==== data ====
{{tag|data}} formats a machine-readable version of contents.
{{tag|data}} formats a machine-readable version of contents.


Line 276: Line 292:
Attributes: <code>value</code>
Attributes: <code>value</code>


====del====
==== del ====
{{tag|del}} formats deleted text.
{{tag|del}} formats deleted text.


Line 284: Line 300:
}}
}}


==== dfn ====
Sometimes {{tag|s}} would be used, but not always because {{tag|del}} would be more appropriate than {{tag|s}} in document editing.
{{tag|dfn}} is used for indicating the defining instance of a term.

====dfn====
{{tag|dfn}} is used for indicating a definition.


{{markup
{{markup
Line 294: Line 308:
}}
}}


Templates: {{tl|dfn}}
Templates: {{tlx|dfn}}


====em====
==== em ====
{{see|MOS:ITALIC}}
{{see|MOS:ITALIC}}
{{tag|em}} represents a span of text with emphatic stress.
{{tag|em}} represents a span of text with emphatic stress (i.e. semantic emphasis). In most browsers, it renders as italic.


{{markup
{{markup
Line 305: Line 319:
}}
}}


Templates: {{tl|em}}
Templates: {{tlx|em}}


====i====
==== i ====
{{see|MOS:ITALIC}}
{{see|MOS:ITALIC}}
{{tag|i}} represents a span of text offset from its surrounding content without conveying any extra emphasis or importance, and for which the conventional typographic presentation is italic text.
{{tag|i}} represents a span of text offset from its surrounding content without conveying any extra emphasis or importance, and for which the conventional typographic presentation is italic text.
Line 322: Line 336:
}}
}}


====ins====
==== ins ====
{{tag|ins}} indicates a range of text that has been added. Styled as underlined text. Used on talk pages to indicate refactored text; see [[WP:REDACT]].
{{tag|ins}} indicates a range of text that has been added. Styled as underlined text. Used on talk pages to indicate refactored text; see [[WP:REDACT]].


Line 330: Line 344:
}}
}}


====kbd====
==== kbd ====
{{tag|kbd}} indicates user input such as keyboard input or voice commands.
{{tag|kbd}} indicates user input such as keyboard input or voice commands (but ''no'' {{kbd|gray background}} as with the template {{tlx|kbd}}).


{{markup
{{markup
Line 339: Line 353:


Templates:
Templates:
* {{tlx|kbd}} applies monospace styling, and a light-grey background to distinguish from code ({{tag|code|o}}) and output ({{tag|samp|o}} or {{tlx|samp}}).
* {{tl|kbd}} applies gray styling
* {{tl|key press}} renders illustrated keys and keystrokes.
* {{tlx|key press}} renders illustrated keys and keystrokes.


====mark====
==== mark ====
{{tag|mark}} represents a run of text in one document marked or highlighted for reference purposes, due to its relevance in another context. Marked text is formatted with a yellow background by default.
{{tag|mark}} represents a run of text in one document marked or highlighted for reference purposes, due to its relevance in another context. Marked text is formatted with a yellow background by default.
{{hidden begin}}
It does not highlight leading or trailing whitespace characters. To do so, use [[non-breaking space]]s instead, e.g., using the function {{tl|spaces}}.
{{hidden end}}


{{markup
{{markup
|<nowiki><mark>HyperText Markup Language</mark></nowiki>
|<nowiki><mark>HyperText Markup Language</mark></nowiki>
|<mark>HyperText Markup Language</mark>
|<mark>HyperText Markup Language</mark>
|<nowiki><mark style="background:lightblue">HyperText Markup Language</mark></nowiki>
|<nowiki><mark style="background:lightblue;">HyperText Markup Language</mark></nowiki>
|4=<mark style="background:lightblue">HyperText Markup Language</mark>
|4=<mark style="background:lightblue;">HyperText Markup Language</mark>
}}
}}


Support: Not supported by Internet Explorer 8 and below.
Support: Not supported by Internet Explorer 8 and below.


====pre====
==== pre ====
{{tag|pre}} element represents a block of preformatted text. In MediaWiki, {{xtag|pre}} is actually a parser tag and not HTML, but the function is the same.
{{tag|pre}} element represents a block of preformatted text. In MediaWiki, {{xtag|pre}} is actually a parser tag and not HTML, but the function is the same. It also prevents the parsing of templates.


{{markup
{{markup
|<nowiki><pre>HyperText Markup Language</pre></nowiki>
|<nowiki><pre>HyperText Markup Language</pre></nowiki>
|col2=Renders as<ref name="white bgcolor"/>
|<pre>HyperText Markup Language</pre>
|col2style=background-color:#fff

|<pre>
HyperText Markup Language
</pre>
}}
}}


'''HTML entities'''
===== HTML entities =====


{{xtag|pre}} parses [[Character encodings in HTML|HTML entities]]. If you want to escape this, replace <code>&</code> with <code>&amp;amp;</code>.
{{tag|pre|o}} parses [[Character encodings in HTML|HTML entities]]. If you want to escape this, replace <code>&</code> with <code>&amp;amp;</code>, or use {{xtag|syntaxhighlight|params = lang="text"}} instead.


{{markup
{{markup
|<nowiki><pre>&amp;amp;</pre></nowiki>
|<nowiki><pre>&amp;amp;</pre></nowiki>
|col2=Renders as<ref name="white bgcolor"/>
|<pre>&amp;</pre>
|col2style=background-color:#fff

|<pre>
&amp;
</pre>
|<nowiki><pre>&amp;lt;</pre></nowiki>
|<nowiki><pre>&amp;lt;</pre></nowiki>

|<pre>&lt;</pre>

|<pre>
&lt;
</pre>
|<nowiki><pre>&amp;amp;amp;</pre></nowiki>
|<nowiki><pre>&amp;amp;amp;</pre></nowiki>

|<pre>&amp;amp;</pre>

|<pre>
&amp;amp;
</pre>
|<nowiki><pre>&amp;amp;lt;</pre></nowiki>
|<nowiki><pre>&amp;amp;lt;</pre></nowiki>

|<pre>&amp;lt;</pre>

|<pre>
&amp;lt;
</pre>
}}
}}


Templates:
Templates:
* {{tl|pre}} wraps text that overflows the page.
* {{tlx|pre}} wraps text that overflows the page.
* {{tl|pre2}} wraps or uses scrollbox.


====q====
==== q ====
{{tag|q}} is used to mark a short quotation.
{{tag|q}} is used to mark a short quotation. There has been very little implementation of this element in Wikipedia yet.


{{markup
{{markup
Line 392: Line 424:
}}
}}


[[MOS:QUOTATIONS]] says Wikipedia should instead use "", {{tl|quote}}, or <nowiki><blockquote></nowiki>.
====rb, rp, rt, ruby====

==== rp, rt, ruby ====


{{see|Ruby character}}
{{see|Ruby character}}


{{tag|ruby}} marks spans of phrasing content with ruby annotations.
{{tag|ruby}} marks spans of phrasing content with ruby annotations.
* {{tag|rt}} marks the ruby text component of a ruby annotation; the ruby text shows in a reduced size over top of the normal characters.

{{tag|rt}} marks the ruby text component of a ruby annotation; the ruby text shows in a reduced size over top of the normal characters.
* {{tag|rp}} is used to provide parentheses around a ruby text component of a ruby annotation, to be shown by user agents that don't support ruby annotations.

{{tag|rb}} (formerly obsolete) Used to mark base text in a ruby annotation

{{tag|rp}} is used to provide parentheses around a ruby text component of a ruby annotation, to be shown by user agents that don’t support ruby annotations.


Browsers that do not support ruby characters will show the ruby text in normal size, enclosed in parentheses and after the normal content.
Browsers that do not support ruby characters will show the ruby text in normal size, enclosed in parentheses and after the normal content.


{{markup
{{markup
|<nowiki><ruby>
|<syntaxhighlight lang="html"><ruby>
東<rp>(</rp><rt>とう</rt><rp>)</rp>
東<rp>(</rp><rt>とう</rt><rp>)</rp>
京<rp>(</rp><rt>きょう</rt><rp>)</rp>
京<rp>(</rp><rt>きょう</rt><rp>)</rp>
</ruby></nowiki>
</ruby></syntaxhighlight>
|<ruby>
|<ruby>
東<rp>(</rp><rt>とう</rt><rp>)</rp>
東<rp>(</rp><rt>とう</rt><rp>)</rp>
Line 418: Line 448:


Templates:
Templates:
* {{tl|ruby}}
* {{tlx|ruby}}
* {{tl|ruby-ja}} for Japanese
* {{tlx|ruby-ja}} for Japanese
* {{tl|Ruby-zh-p}} for Chinese pinyin
* {{tlx|Ruby-zh-p}} for Chinese pinyin
* {{tl|Ruby-zh-b}} for Chinese bopomofo
* {{tlx|Ruby-zh-b}} for Chinese bopomofo


====s====
==== s ====
{{tag|s}} is used to indicate content that is no longer accurate or relevant and that has been struck from the page. It is not appropriate when indicating document edits; to mark a span of text as having been removed from a document, use {{tag|del|o}}.
{{tag|s}} is used to indicate content that is no longer accurate or relevant and that has been struck from the page. It is not appropriate when indicating document edits; to mark a span of text as having been removed from a document, use {{tag|del|o}}.


Line 431: Line 461:
}}
}}


Templates: {{tl|strikethrough}}
Templates: {{tlx|strikethrough}}


====samp====
==== samp ====
{{tag|samp}} indicates output from a program or computing system.
{{tag|samp}} indicates sample output from a program or computing system. Examples include: output of a program, script, or Wikipedia template; status displays or audio announcements made by an app or device; file system directory listings and samples from them, such as paths and file names.


{{markup
{{markup
|<nowiki><samp>HyperText Markup Language</samp></nowiki>
|<nowiki>sample output: <samp>HTML</samp></nowiki>
|<samp>HyperText Markup Language</samp>
|sample output: <samp>HTML</samp>
}}
}}


Templates: {{tl|samp}} applies gray styling
Templates: {{tlx|samp}} applies monospace styling, and gives the text in dark grey to distinguish from code ({{tag|code|o}}) and input ({{tag|kbd|o}} or {{tlx|kbd}}).


====small====
==== small ====
{{see|WP:FONTSIZE}}
{{see|WP:FONTSIZE}}
{{tag|small}} format small text.
{{tag|small}} format small text.
Line 453: Line 483:


Templates:
Templates:
* {{tl|small}} uses {{tag|small|o|params=style="font-size:85%;"}}. {{tl|small}} is recommended over {{tag|small|o}} since not all browsers render small text the same.
* {{tlx|small}} uses {{tag|span|o|params=style="font-size:85%;"}}. {{tlx|small}} is recommended over {{tag|small|o}} since {{tag|small}} has a semantic meaning that is for [[fine print]], whereas {{tlx|small}} is purely stylistic.


====strong====
==== strong ====
{{tag|strong}} formats a span of text with strong importance or unusual emphasis; in most browsers it renders as boldface. This should generally not be used in Wikipedia articles, per [[WP:Neutral point of view]] policy. See [[MOS:BOLD]] on use of this element and other boldfacing. Most semantic emphasis, including in quoted material, should be rendered with the {{tag|em|o}} element.
{{tag|strong}} formats a span of text with strong importance.


{{markup
{{markup
Line 463: Line 493:
}}
}}


Templates: {{tl|strong}}
Templates: {{tlx|strong}}


====sub====
==== sub ====
{{see|WP:SUBSCRIPT}}
{{see|WP:SUBSCRIPT}}
{{tag|sub}} formats a span of text as a subscript.
{{tag|sub}} formats a span of text as a subscript.
Line 474: Line 504:
}}
}}


Templates:
Templates:{{hlist|
* {{tl|sub}} ({{sub|subscript}} text)
| {{tlx|sub}} ({{sub|subscript}} text)
* {{tl|subsub}} ({{subsub|subscript subscript}} text)
| {{tlx|subsub}} ({{subsub|subscript subscript}} text)
* {{tl|ssub}} ({{ssub|subscript, small}} text)
| {{tlx|ssub}} ({{ssub|subscript, small}} text)
* {{tl|sup}} ({{sup|superscript}} text)
| {{tlx|sup}}{{nbsp}}({{sup|superscript}} text)
* {{tl|su}} ({{su|p=superscript|b=subscript}} text)
| {{tlx|su}} ({{su|p=superscript|b=subscript}} text)
* {{tl|sup sub}} (text{{sup sub|sup|sub}})
| {{tlx|sup sub}} (text{{sup sub|sup|sub}})
* {{tl|e}} (1.23{{e|4}})
| {{tlx|e}} (1.23{{e|4}})
|style=line-height:2.5
|indent=3}}


====sup====
==== sup ====
{{see|WP:SUPSCRIPT}}
{{see|WP:SUPSCRIPT}}
{{tag|sup}} formats a span of text as a superscript.
{{tag|sup}} formats a span of text as a superscript.
Line 493: Line 525:


Templates:
Templates:
* {{tl|sub}} ({{sub|subscript}} text)
* {{tlx|sub}} ({{sub|subscript}} text)
* {{tl|subsub}} ({{subsub|subscript subscript}} text)
* {{tlx|subsub}} ({{subsub|subscript subscript}} text)
* {{tl|ssub}} ({{ssub|subscript, small}} text)
* {{tlx|ssub}} ({{ssub|subscript, small}} text)
* {{tl|sup}} ({{sup|superscript}} text)
* {{tlx|sup}} ({{sup|superscript}} text)
* {{tl|su}} ({{su|p=superscript|b=subscript}} text)
* {{tlx|su}} ({{su|p=superscript|b=subscript}} text)
* {{tl|sup sub}} (text{{sup sub|sup|sub}})
* {{tlx|sup sub}} (text{{sup sub|sup|sub}})
* {{tl|e}} (1.23{{e|4}})
* {{tlx|e}} (1.23{{e|4}})


====time====
==== time ====
{{tag|time}} defines either a time (24 hour clock), or a date in the Gregorian calendar, optionally with a time and a time-zone offset.
{{tag|time}} defines either a time (24 hour clock), or a date in the Gregorian calendar, optionally with a time and a time-zone offset.


Line 513: Line 545:
Support: Not supported by Internet Explorer 8 and below.
Support: Not supported by Internet Explorer 8 and below.


====u====
==== u ====
{{see|MOS:BADEMPHASIS|MOS:QUOTE}}
{{see|MOS:BADEMPHASIS|MOS:QUOTE}}
{{tag|u}} represents a span of text offset from its surrounding content without conveying any extra emphasis or importance, and for which the conventional typographic presentation is underlining; for example, a span of text in Chinese that is a proper name (a Chinese proper name mark), or span of text that is known to be misspelled.
{{tag|u}} represents a span of text offset from its surrounding content without conveying any extra emphasis or importance, and for which the conventional typographic presentation is underlining; for example, a span of text in Chinese that is a proper name (a Chinese proper name mark), or span of text that is known to be misspelled.

{{tag|u|o}} was [[HTML element#Presentational markup|presentational element of HTML]] that was originally used to underline text; this usage was [[deprecated]] in HTML4 in favor of the [[CSS]] style <code>{text-decoration: underline}</code>.<ref name=mozilla>{{cite web |url=https://developer.mozilla.org/en-US/docs/Web/HTML/Element/u |title=&lt;u&gt;: The Unarticulated Annotation (Underline) element | date = 1 August 2020 |access-date= 9 October 2020 | website= mozilla.org}}</ref> In HTML5, the tag reappeared but its meaning was changed significantly: it now "represents a span of inline text which should be rendered in a way that indicates that it has a non-textual annotation".<ref name=mozilla /> This facility is intended for example to provide a red wavy line underline to flag spelling errors at input time but which are not to be embedded in any stored file (unlike an emphasis mark, which would be).


{{markup
{{markup
|<nowiki><u>HyperText Markup Language</u></nowiki>
|<u>HyperText Markup Language</u>
|<u>HyperText Markup Language</u>
|<u>HyperText Markup Language</u>
}}
}}


Templates: {{tl|underline}}
Templates: {{tlx|underline}} (which supplies the recommended CSS style)


====var====
==== var ====
{{see|MOS:ITALIC}}
{{see|MOS:ITALIC}}
{{tag|var}} formats text in italics to indicate a variable in a mathematical expression or programming context, or placeholder text that the reader is meant to mentally replace with some other literal value.
{{tag|var}} formats text in italics to indicate a variable in a mathematical expression or programming context, or placeholder text that the reader is meant to mentally replace with some other literal value.


{{markup
{{markup
|1=<syntaxhighlight lang="wikitext">
|<nowiki><var>HyperText Markup Language</var></nowiki>
*<var>E</var>=<var>m</var>c<sup>2</sup> (c is a constant not a variable)
|<var>HyperText Markup Language</var>
*<code><nowiki>{{</nowiki><var>TemplateName</var>|<var>parameter</var>=<var>value</var><nowiki>}}</nowiki></code>
*If <var>A</var> then <var>B</var>

</syntaxhighlight>

|2=
*<var>E</var>=<var>m</var>c<sup>2</sup> (c is a constant not a variable)<br />
*<code><nowiki>{{</nowiki><var>TemplateName</var>{{!}}<var>parameter</var>=<var>value</var><nowiki>}}</nowiki></code><br />
*If <var>A</var> then <var>B</var>
}}
}}


Templates:
Templates:
* {{tl|var}}
* {{tlx|var}}
* {{tl|varserif}} formatted in italic serif to differentiate characters
* {{tlx|varserif}} formatted in italic serif to differentiate characters


====wbr====
==== wbr ====
{{see| Wikipedia:Line-break handling}}
{{see|Help:Line-break handling#&lt;wbr&gt; and soft hyphens}}
{{tag|wbr|o}} is a word break opportunity; that is, it specifies where it would be OK to add a line-break where a word is too long, or it is perceived that the browser will break a line at the wrong place.
{{tag|wbr|o}} is a word break opportunity; that is, it specifies where it would be OK to add a line-break where a word is too long, or it is perceived that the browser will break a line at the wrong place.


Line 546: Line 589:


|<nowiki>Now is the time to become a power editor, by learning Hyper<wbr>Text Markup Language</nowiki>
|<nowiki>Now is the time to become a power editor, by learning Hyper<wbr>Text Markup Language</nowiki>
|Now is the time to become a power editor, by learning Hyper<wbr>Text Markup Language
|Now is the time to become a power editor, by learning Hyper<wbr />Text Markup Language
}}
}}


As the browser window is adjusted narrower, the second example wraps between ''Hyper'' and ''Text''.
As the browser window is adjusted narrower, the second example wraps between ''Hyper'' and ''Text''.


===Lists===
=== Lists ===
{{see|Help:List|MOS:LIST}}
{{see|Help:List|MOS:LIST}}


Do not leave blank lines between items in a list unless there is a reason to do so, since this causes the MediaWiki software to interpret each item as beginning a new list.
Do not leave blank lines between items in a list unless there is a reason to do so, since this causes the MediaWiki software to interpret each item as beginning a new list.


====dl, dt, dd====
==== dl, dt, dd ====
{{tag|dl}}, {{tag|dt}} and {{tag|dd}} are used to create a description list (formerly definition list) with terms and descriptions. Terms are displayed in bold and descriptions are indented. Each term <em>must</em> include one or more descriptions.
{{tag|dl}}, {{tag|dt}} and {{tag|dd}} are used to create a description list (formerly definition list) with terms and descriptions. Terms are displayed in bold and descriptions are indented. Each term <em>must</em> include one or more descriptions.


{{markup
{{markup
|<nowiki><dl>
|<syntaxhighlight lang="html"><dl>
<dt>Term</dt>
<dt>Term</dt>
<dd>Definition 1</dd>
<dd>Definition 1</dd>
<dd>Definition 2</dd>
<dd>Definition 2</dd>
</dl></syntaxhighlight>
<dd>Definition 3</dd>
<dd>Definition 4</dd>
</dl></nowiki>
|<dl>
|<dl>
<dt>Term</dt>
<dt>Term</dt>
<dd>Definition 1</dd>
<dd>Definition 1</dd>
<dd>Definition 2</dd>
<dd>Definition 2</dd>
<dd>Definition 3</dd>
<dd>Definition 4</dd>
</dl>
</dl>
}}
}}
Line 579: Line 618:


{{markup
{{markup
|<nowiki>; Term
|<syntaxhighlight lang="wikitext">; Term
: Definition 1
: Definition 1
: Definition 2
: Definition 2</syntaxhighlight>
: Definition 3
: Definition 4</nowiki>
|<dl><!-- this wikimarkup does not render in this template -->
|<dl><!-- this wikimarkup does not render in this template -->
<dt>Term</dt>
<dt>Term</dt>
<dd>Definition 1</dd>
<dd>Definition 1</dd>
<dd>Definition 2</dd>
<dd>Definition 2</dd>
<dd>Definition 3</dd>
<dd>Definition 4</dd>
</dl>
</dl>
}}
}}


Templates: {{tl|defn}}
Templates: {{tlx|defn}}


====ol, ul, li====
==== ol, ul, li ====
{{tag|ol}} represents an ordered list; {{tag|ul}} represents an unordered list; {{tag|li}} represents a list item within either type of list.
{{tag|ol}} represents an ordered list; {{tag|ul}} represents an unordered list; {{tag|li}} represents a list item within either type of list.


{{markup
{{markup
|<nowiki><ol>
|<syntaxhighlight lang="html"><ol>
<li>Item 1</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 2</li>
</ol></syntaxhighlight>
<li>Item 3</li>
<li>Item 4</li>
</ol></nowiki>
|<ol>
|<ol>
<li>Item 1</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ol>
</ol>
|<nowiki><ul>
|<syntaxhighlight lang="html"><ul>
<li>Item 1</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 2</li>
</ul></syntaxhighlight>
<li>Item 3</li>
<li>Item 4</li>
</ul></nowiki>
|<ul>
|<ul>
<li>Item 1</li>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</ul>
</ul>
}}
}}
Line 627: Line 654:
Wikimarkup: use <code>*</code> for items in an unordered list and <code>#</code> for ordered lists.
Wikimarkup: use <code>*</code> for items in an unordered list and <code>#</code> for ordered lists.
{{markup
{{markup
|1=<nowiki># Item 1
|1=<syntaxhighlight lang="wikitext"># Item 1
# Item 2
# Item 2</syntaxhighlight>
# Item 3
# Item 4</nowiki>
|2=<nowiki />
|2=<nowiki />
# Item 1
# Item 1
# Item 2
# Item 2
|3=<syntaxhighlight lang="wikitext">* Item 1
# Item 3
# Item 4
* Item 2</syntaxhighlight>
|3=<nowiki>* Item 1
* Item 2
* Item 3
* Item 4</nowiki>
|4=<nowiki />
|4=<nowiki />
* Item 1
* Item 1
* Item 2
* Item 2
* Item 3
* Item 4
}}
}}


Templates: for a variety of specialized uses, see [[:Category:Wikipedia list formatting templates]].
Templates: for a variety of specialized uses, see [[:Category:List formatting and function templates]].


=== Containers ===
Note that if your "*" creates bullet points instead of the star symbol, use {{tag|nowiki}}.


===Containers===
==== div ====

====div====
{{see|Span and div}}
{{see|Span and div}}
{{tag|div}} is a generic container for flow content that displays as a block element.
{{tag|div}} is a generic container for flow content that displays as a block element.
Line 662: Line 679:
}}
}}


====span====
==== span ====
{{see|Span and div}}
{{see|Span and div}}
{{tag|span}} is a container for flow content that displays as an inline element.
{{tag|span}} is a container for flow content that displays as an inline element.
Line 668: Line 685:
{{markup
{{markup
|<nowiki>HyperText <span>Markup</span> Language</nowiki>
|<nowiki>HyperText <span>Markup</span> Language</nowiki>
|HyperText <span>Markup</span> Language
|HyperText Markup Language
}}
}}


===Tables===
=== Tables ===
{{see|Help:Table|MOS:TABLES}}
{{see|Help:Table|MOS:TABLES}}


====table, td, tr====
==== table, td, tr ====
{{tag|table}} defines a table.
{{tag|table}} defines a table.


{{tag|tr}} defines a table row.
* {{tag|tr}} defines a table row.
* {{tag|td}} defines a data cell with contents that may include text, links, images, lists, forms, other tables, etc.

{{tag|td}} defines a data cell with contents that may include text, links, images, lists, forms, other tables, etc.


{{markup
{{markup
|<nowiki><table border=1>
|<syntaxhighlight lang="html"><table border=1>
<tr>
<tr>
<td>data</td>
<td>data</td>
<td>data</td>
<td>data</td>
</tr>
</tr>
</table></nowiki>
</table></syntaxhighlight>
|2=<table border=1>
|2=<table border=1>
<tr>
<tr>
Line 699: Line 715:
* {{tag|table|o}}:
* {{tag|table|o}}:
*: Allowed but not recommended: <code>border=""</code> and <code>border="1"</code>
*: Allowed but not recommended: <code>border=""</code> and <code>border="1"</code>
*: Allowed but obsolete: <code>border</code> (with a non-empty value different from "1"), <code>align</code>, <code>bgcolor</code>, <code>cellpadding</code>, <code>cellspacing</code>, <code>frame</code>, <code>rules</code>, <code>summary</code>, <code>width</code><ref name=w3c_obsolete />
*: Allowed but obsolete: <code>border</code> (with a non-empty value different from "1"), <code>align</code>, <code>bgcolor</code>, <code>cellpadding</code>, <code>cellspacing</code>, <code>frame</code>, <code>rules</code>, <code>summary</code>, <code>width</code><ref name="w3c_obsolete" />
* {{tag|td|o}}: <code>colspan</code>, <code>headers</code>, <code>rowspan</code>
* {{tag|td|o}}: <code>colspan</code>, <code>headers</code>, <code>rowspan</code>
*: Allowed but obsolete: <code>abbr</code>, <code>align</code>, <code>axis</code>, <code>bgcolor</code>, <code>scope</code>, <code>height</code>, <code>nowrap</code>, <code>valign</code>, <code>width</code><ref name=w3c_obsolete />
*: Allowed but obsolete: <code>abbr</code>, <code>align</code>, <code>axis</code>, <code>bgcolor</code>, <code>scope</code>, <code>height</code>, <code>nowrap</code>, <code>valign</code>, <code>width</code><ref name="w3c_obsolete" />


====th====
==== th ====
{{tag|th}} defines a table header; styled as centered and bold.
{{tag|th}} defines a table header; styled as centered and bold.


{{markup
{{markup
|<nowiki><table border="1">
|<syntaxhighlight lang="html"><table border="1">
<tr>
<tr>
<th>Header</th>
<th>Header</th>
Line 716: Line 732:
<td>data</td>
<td>data</td>
</tr>
</tr>
</table></nowiki>
</table></syntaxhighlight>
|2=<table border="1">
|2=<table border="1">
<tr>
<tr>
Line 731: Line 747:
Attributes:
Attributes:
* {{tag|th|o}}: <code>colspan</code>, <code>headers</code>, <code>rowspan</code>, <code>scope</code>
* {{tag|th|o}}: <code>colspan</code>, <code>headers</code>, <code>rowspan</code>, <code>scope</code>
*: Allowed but obsolete: <code>abbr</code>, <code>align</code>, <code>axis</code>, <code>bgcolor</code>, <code>scope</code>, <code>height</code>, <code>nowrap</code>, <code>valign</code>, <code>width</code><ref name=w3c_obsolete />
*: Allowed but obsolete: <code>abbr</code>, <code>align</code>, <code>axis</code>, <code>bgcolor</code>, <code>height</code>, <code>nowrap</code>, <code>valign</code>, <code>width</code><ref name="w3c_obsolete" />


====caption====
==== caption ====
{{tag|caption}} adds a caption to a table.
{{tag|caption}} adds a caption to a table.


{{markup
{{markup
|<nowiki><table border=1>
|<syntaxhighlight lang="html"><table border=1>
<caption>Caption</caption>
<caption>Caption</caption>
<tr>
<tr>
Line 743: Line 759:
<td>data</td>
<td>data</td>
</tr>
</tr>
</table></nowiki>
</table></syntaxhighlight>
|2=<table border=1>
|2=<table border=1>
<caption>Caption</caption>
<caption>Caption</caption>
Line 755: Line 771:
Attributes:
Attributes:
* {{tag|caption|o}}:
* {{tag|caption|o}}:
*: Allowed but obsolete: <code>align</code><ref name=w3c_obsolete />
*: Allowed but obsolete: <code>align</code><ref name="w3c_obsolete" />


====thead, tfoot, tbody====
==== thead, tfoot, tbody ====
{{tag|thead|o}}, {{tag|tfoot|o}} and {{tag|tbody|o}} are not supported, but are automatically generated when the page is rendered.
{{tag|thead|o}}, {{tag|tfoot|o}} and {{tag|tbody|o}} are not supported, but are automatically generated when the page is rendered.


==Obsolete elements==
== Obsolete/deprecated elements ==
{{main|Wikipedia:HTML5#Obsolete elements and attributes}}
These elements are now obsolete in HTML5, but still supported by browsers.<ref name=w3c_obsolete /> These tags either have an alternate tag or a template that replaces their function with CSS.
These elements are now obsolete and either deprecated or removed in HTML5, but still supported by browsers.<ref name="w3c_obsolete" /> These tags should not be used on Wikipedia. These tags either have an alternate tag or a template that replaces their function with CSS. See {{slink|Wikipedia:HTML5#Obsolete elements and attributes}} for more details on obsolete HTML parts and their replacements.


===big===
=== center ===
{{dc|{{tag|big}} (obsolete)}} formats text in a larger font size.

{{markup
|<nowiki><big>HyperText Markup Language</big></nowiki>
|<big>HyperText Markup Language</big>
}}

Templates: {{tl|big}} uses CSS.

===center===
{{for|centering tables|Help:Table#Centering tables}}
{{for|centering tables|Help:Table#Centering tables}}
{{dc|{{tag|center}} (obsolete)}} is used to center text elements.
{{dc|{{tag|center}} (obsolete)}} is used to center text elements.


Templates: {{tlx|center}} uses CSS.
{{markup
|<nowiki><center>HyperText Markup Language</center></nowiki>
|<center>HyperText Markup Language</center>
}}

Templates: {{tl|center}} uses CSS.


===font===
=== font ===
{{dc|{{tag|font}} (obsolete)}} is used to set the font size, font face and color of text.
{{dc|{{tag|font}} (obsolete)}} is used to set the font size, font face and color of text.


Templates: {{tlx|font}} uses CSS.
{{markup
|<nowiki><font size="3" face="verdana" color="green">HyperText Markup Language</font></nowiki>
|2=<font size="3" face="verdana" color="green">HyperText Markup Language</font>
}}


=== rb ===
Templates: {{tl|font}} uses CSS.
{{dc|{{tag|rb}} (obsolete)}} Used to mark base text in a ruby annotation


For replacements, see: [[Help:HTML in wikitext#rp, rt, ruby]]
===strike===
{{dc|{{tag|strike}}}} (obsolete) formats strike-through characters; use {{tag|s|o}} instead.


=== strike ===
{{markup
{{dc|{{tag|strike}} (obsolete)}} formats strike-through characters; use {{tag|s|o}} instead.
|<nowiki><strike>HyperText Markup Language</strike></nowiki>
|<strike>HyperText Markup Language</strike>
}}


===tt===
=== tt ===
{{dc|{{tag|tt}} (obsolete)}} formats text in a fixed-width font. Use {{tag|code|o}}, {{tag|kbd|o}} or {{tag|samp|o}} instead.
{{dc|{{tag|tt}} (obsolete)}} formats text in a fixed-width font. Use {{tag|code|o}}, {{tag|kbd|o}} or {{tag|samp|o}} instead.


Templates: {{tlx|mono}} uses CSS.
{{markup
|<nowiki><tt>HyperText Markup Language</tt></nowiki>
|<tt>HyperText Markup Language</tt>
}}


==Unsupported elements==
== Unsupported elements ==


These elements are not supported, but have equivalent wiki markup. Attempting to use any element not whitelisted by {{sanitizer.php}} will result in the markup showing as plain text.
These elements are not supported, but have equivalent wiki markup. Attempting to use any element not whitelisted by {{sanitizer.php}} will result in the markup showing as plain text.


===a===
=== a ===
{{details|Help:Wiki markup#Links and URLs}}
{{details|Help:Wiki markup#Links and URLs}}
{{tag|a|o}} is used to create links. Use the <code><nowiki>[[ ]]</nowiki></code> wikimarkup for internal links and <code><nowiki>[ ]</nowiki></code> for external links.
{{tag|a|o}} is used to create links. Use the <code><nowiki>[[ ]]</nowiki></code> wikimarkup for internal/intrawiki links and [[Help:Interwiki linking|interwiki links]], and <code><nowiki>[ ]</nowiki></code> for external links.


===input===
=== input ===
{{details|mw:Extension:InputBox}}
{{details|mw:Extension:InputBox}}
{{tag|input|o}} is used to create [[Form (HTML)|forms]]. The {{xtag|inputbox}} extension tag is used to create a text box with a button.
{{tag|input|o}} is used to create [[Form (HTML)|forms]]. The {{xtag|inputbox}} extension tag is used to create a text box with a button.


==HTML Tidy==
== HTML Tidy ==
[[HTML Tidy]] is enabled for the English Wikipedia. Tidy parses the MediaWiki output and cleans it up to ensure that valid HTML is rendered. For example, {{tag|br|o}}, {{tag|br|c}}, {{tag|br/|o}}, {{tag|br.|o}} will all render as {{tag|br|s}}. Tidy is not enabled for [[Help:MediaWiki namespace|MediaWiki interface pages]]. Tidy is not perfect, and has been known to introduce errors.
[[HTML Tidy]] is an outdated HTML4 library that is [[:mw:Parsing/Replacing Tidy|slated for removal]]. Tidy parses the MediaWiki output and cleans it up to increase the likelihood that valid HTML4 is rendered. For example, with Tidy enabled, {{tag|br|o}}, {{tag|br|c}}, {{tag|br/|o}}, {{tag|br.|o}} all rendered as {{tag|br|s}}. Tidy is not enabled for [[Help:MediaWiki namespace|MediaWiki interface pages]]. Tidy was never perfect and has been known to introduce errors.


==Exceptions==
== Exceptions ==
In some pages in the [[Help:MediaWiki namespace|MediaWiki namespace]], typically the short messages like button labels, HTML is not parsed, and tags will be exposed.
In some pages in the [[Help:MediaWiki namespace|MediaWiki namespace]], typically the short messages like button labels, HTML is not parsed, and tags will be exposed.


User and sitewide [[CSS]] and [[Javascript]] pages are interpreted as if inside a {{tag|pre|o}} block. See [[Help:User style]].
User and sitewide [[CSS]] and [[JavaScript]] pages are interpreted as if inside a {{tag|pre|o}} block. See [[Help:User style]].


==Validation==
== Validation ==
{{main|Help:Markup validation}}
{{Main|Help:Markup validation}}
The MediaWiki software attempts to fix HTML errors, but it does not catch all of them. Where HTML is used, it is helpful to verify it with the [[W3C Markup Validation Service]].
The MediaWiki software attempts to fix HTML errors, but it does not catch all of them. Where HTML is used, it is helpful to verify it with the [[W3C Markup Validation Service]].


==Parser and extension tags==
== Parser and extension tags ==
{{shortcut|Help:Extension tag|Help:Parser tag}}
{{shortcut|Help:Extension tag|Help:Parser tag}}
{{#section:Template:Xtag/doc|xtag}}
The MediaWiki software adds elements that look and act like HTML tags. Parser tags are included in MediaWiki whereas extension tags are added by optional software extensions. Installed tags are listed at [[Special:Version]].


== See also ==
;Parser tags :{{xtag|gallery}}, {{xtag|nowiki}}, {{xtag|pre}}
* [[Help:Wikitext]]
* [[Wikipedia:HTML5]]
* [[:Category:Wikipedia XHTML tag-replacing templates]]


== References ==
;Extension tags :{{xtag|categorytree}}, {{xtag|charinsert}}, {{xtag|gallery}}, {{xtag|hiero}}, {{xtag|imagemap}}, {{xtag|inputbox}}, {{xtag|math}}, {{xtag|nowiki}}, {{xtag|poem}}, {{xtag|ref}}, {{xtag|references}}, {{xtag|score}}, {{xtag|section}}, {{xtag|syntaxhighlight}} (alias {{xtag|source}}), {{xtag|templatedata}}, {{xtag|timeline}}

==References==
{{reflist|refs=
{{reflist|refs=
<ref name=w3c_obsolete>{{cite web |title=HTML5: A vocabulary and associated APIs for HTML and XHTML: Obsolete Features |work=W3C |date=31 July 2014 |url=http://www.w3.org/TR/html5/obsolete.html}}</ref>
<ref name="w3c_obsolete">{{cite web |title=HTML5: A vocabulary and associated APIs for HTML and XHTML: Obsolete Features |work=W3C |date=31 July 2014 |url=http://www.w3.org/TR/html5/obsolete.html}}</ref>
<ref name=sanitizer>Allowable elements and attributes are defined in the {{sanitizer.php}} module.</ref>
<ref name="sanitizer">Allowable elements and attributes are defined in the {{sanitizer.php}} module.</ref>
<ref name=html5microdata>{{cite web |title=The microdata model |work=HTML Living Standard |url=http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#the-microdata-model}}</ref>
<ref name="html5microdata">{{cite web |title=The microdata model |work=HTML Living Standard |url=http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#the-microdata-model}}</ref>
}}
}}


==External links==
== External links ==
* HTML 4.01 specification: [http://www.w3.org/TR/html401/index/elements.html elements] | [http://www.w3.org/TR/html401/index/attributes.html attributes]
* HTML 4.01 specification: [http://www.w3.org/TR/html401/index/elements.html elements] | [http://www.w3.org/TR/html401/index/attributes.html attributes]
* HTML 5.2 specification: [https://www.w3.org/TR/html5/fullindex.html#index-elements elements] | [https://www.w3.org/TR/html5/fullindex.html#attributes-table attributes]

{{Wikipedia directories}}
{{Wikipedia editor navigation}}


{{Help navigation}}
[[Category:Wikipedia editor handbook]]
[[Category:Wikipedia editor help]]
[[Category:Wikipedia editor help]]

Latest revision as of 23:00, 14 February 2024

The MediaWiki software, which drives Wikipedia, allows the use of a subset of HTML 5 elements, or tags and their attributes, for presentation formatting.[1] But most HTML can be included by using equivalent wiki markup or templates; these are generally preferred within articles, as they are sometimes simpler for most editors and less intrusive in the editing window; but Wikipedia's Manual of Style recommends their use in certain cases. (See Help:Wikitext for wiki equivalents to HTML tags not otherwise discussed below.) And HTML is useful outside of articles, for example for formatting within templates. For help with Cascading Style Sheet use within Wikipedia see Help:Cascading Style Sheets.

Some tags look like HTML, but are actually MediaWiki parser and extension tags, and so are really wiki markup. HTML in pages can be checked for HTML5 compliance by using validation. Some elements and attributes are supported by MediaWiki and browsers, but have been deprecated by HTML5, and therefore should no longer be used.

Tutorials

This help page gives only an overview of allowed markup. For further assistance and detailed specifications:

Attributes

HTML attributes provide additional information about an element and are always specified in the start tag. They are formatted as a name/value pair like name="value".

Global attributes apply to all tags. Attributes not listed here are not allowed by MediaWiki[1]:

  • class: one or more classifications to which the element belongs. See Wikipedia:Catalogue of CSS classes.
  • dir: text direction— "ltr" (left-to-right), "rtl" (right-to-left) or "auto".
  • id: unique identifier for the element.
  • lang: primary language for the contents of the element per BCP 47.
  • style: applies CSS styling to the contents of the element.
  • title: advisory information associated with the element.

HTML5 microdata attributes apply to all tags:[2]

  • Any attribute beginning with data-
  • itemid
  • itemprop
  • itemref
  • itemscope
  • itemtype

Other tags such as <table> support specific attributes – these are listed in the appropriate section.

Markup Renders as
This is <span style="color:red;">red</span> text.

This is red text.

The MediaWiki Sanitizer.php does some cleanup on attributes. A best practice is to use the proper syntax.

  • Discards attributes not on a whitelist for the given element.
  • Turns broken or invalid entities into plaintext.
  • Double-quotes all attribute values.
  • Attributes without values are given the name as value.
  • Double attributes are discarded.
  • Unsafe style attributes are discarded.
  • Prepends space if there are attributes.

Elements

These HTML elements are supported by the MediaWiki software. This section gives a brief overview of the HTML element, an example, relevant wikimarkup and templates.

Basic

h1, h2, h3, h4, h5, h6

The <h1>...</h1> through <h6>...</h6> tags are headings for the sections with which they are associated. <h1> is used for the article title. Headings are styled through CSS and added to the page's table of contents.

Markup Renders as
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6

Wikimarkup: surround the text with the appropriate number of equal signs. Headers formatted with wikimarkup add an [edit] link.

Markup Renders as
= Heading 1 =
== Heading 2 ==
=== Heading 3 ===
==== Heading 4 ====
===== Heading 5 =====
====== Heading 6 ======
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6


Templates: {{fake heading}} for use in documentation

p

<p>...</p> tag places content into a separate paragraph.

Markup Renders as
<p>HyperText Markup Language</p><p>HyperText Markup Language</p>

HyperText Markup Language

HyperText Markup Language

Wikimarkup: Separate paragraphs by a single blank line.

Markup Renders as
HyperText Markup Language

HyperText Markup Language

HyperText Markup Language

HyperText Markup Language

<p>...</p> is especially useful in lists, for list items with multiple paragraphs:

Markup Renders as
* <p>This is a paragraph.</p><p>This is another paragraph in the same item.</p>
* This is a different item.
  • This is a paragraph.

    This is another paragraph in the same item.

  • This is a different item.

Note that the closing tag </p> is not strictly necessary for MediaWiki installations that output HTML 5 (such as Wikipedia).

br

<br> inserts a line break. See H:BR for the other 4 versions that the MediaWiki software converts to <br /> in the HTML that browsers read.

Markup Renders as
HyperText<br>Markup Language

HyperText
Markup Language

Templates:

  • {{break}} adds multiple line breaks.
  • {{crlf2}} adds a true carriage return and line feed.
  • {{clear}} adds a break with styling to clear floating elements.
  • {{plainlist}} creates an unbulleted list.

hr

<hr> or <hr /> represents a paragraph-level thematic break and presents as a horizontal rule.

Markup Renders as
<hr />

Wikimarkup: use ----

Markup Renders as
----


Templates: {{hr}}

Comments

<!--...--> formats the enclosed text as a hidden comment.

Markup Renders as
HyperText<!--Markup Language-->

HyperText

Be careful with spacing around comments. Surrounding a comment with blank lines will result in a blank paragraph, perceived as an extra two blank lines:

Markup Renders as
Content line 1

<!-- Comment -->

Content line 2

Content line 1


Content line 2

Formatting

abbr

<abbr>...</abbr> creates a tooltip to define an abbreviation or acronym that is displayed on mouse-over.

Markup Renders as
<abbr title="HyperText Markup Language">HTML</abbr>

HTML

Templates: {{abbr}}

b

<b>...</b> formats text stylistically offset from other text (bold) without conveying extra importance.

Markup Renders as
<b>HyperText Markup Language</b>

HyperText Markup Language

Wikimarkup: Use ''' to open and close bold text.

Markup Renders as
'''HyperText Markup Language'''

HyperText Markup Language

bdi

<bdi>...</bdi> isolates the content from the surrounding text-direction settings.

Markup Renders as
اليمين إلى اليسارleft to right

اليمين إلى اليسارleft to right

اليمين إلى اليسار<bdi>left to right</bdi>

اليمين إلى اليسارleft to right

Support: Firefox, Chrome

bdo

<bdo>...</bdo> specifies the text direction.

Attributes and values:

  • dir – Specifies the text direction.
    • ltr
    • rtl
Markup Renders as
<bdo dir="rtl">HyperText Markup Language</bdo>

HyperText Markup Language

blockquote

<blockquote>...</blockquote> presents text in an offset block.

Markup Renders as
<blockquote>HyperText Markup Language</blockquote>

HyperText Markup Language

Templates: {{quote}}; supports pre-formatted attribution and source parameters. For other specialized quotation templates, see Category:Quotation templates.

cite

<cite>...</cite> contains the title of a work. This is a new definition in HTML5— in the previous XML implementation <cite> was used to contain a citation or a reference to other sources. No formatting is applied when this tag is used.

Markup Renders as
<cite>HyperText Markup Language</cite>

HyperText Markup Language

<cite>...</cite> is generally not used directly in Wikipedia articles, and is often misused; see Wikipedia:HTML 5#cite for replacement instructions.

code

<code>...</code> formats a section of computer code. Styled with CSS through mediawiki.skinning/elements.less as a black monospaced typeface with a grey background (#F8F9FA) and border (#EAECF0).

Markup Renders as[3]
use <code>this code</code>

use this code

Templates: {{code}} uses <syntaxhighlight>. See the "See also" section at the template page for additional code-markup templates.

See § samp and § kbd on this page for semantic markup of output and input, respectively.

data

<data>...</data> formats a machine-readable version of contents.

Markup Renders as
<data value="978-0764502149">HTML for Dummies</data>

HTML for Dummies

Attributes: value

del

<del>...</del> formats deleted text.

Markup Renders as
<del>HyperText Markup Language</del>

HyperText Markup Language

dfn

<dfn>...</dfn> is used for indicating the defining instance of a term.

Markup Renders as
<dfn>Definition</dfn>

Definition

Templates: {{dfn}}

em

<em>...</em> represents a span of text with emphatic stress (i.e. semantic emphasis). In most browsers, it renders as italic.

Markup Renders as
<em>HyperText Markup Language</em>

HyperText Markup Language

Templates: {{em}}

i

<i>...</i> represents a span of text offset from its surrounding content without conveying any extra emphasis or importance, and for which the conventional typographic presentation is italic text.

Markup Renders as
<i>HyperText Markup Language</i>

HyperText Markup Language

Wikimarkup: Use '' to open and close italic text.

Markup Renders as
''HyperText Markup Language''

HyperText Markup Language

ins

<ins>...</ins> indicates a range of text that has been added. Styled as underlined text. Used on talk pages to indicate refactored text; see WP:REDACT.

Markup Renders as
<ins>HyperText Markup Language</ins>

HyperText Markup Language

kbd

<kbd>...</kbd> indicates user input such as keyboard input or voice commands (but no gray background as with the template {{kbd}}).

Markup Renders as
Press <kbd>Enter</kbd>

Press Enter

Templates:

  • {{kbd}} applies monospace styling, and a light-grey background to distinguish from code (<code>) and output (<samp> or {{samp}}).
  • {{key press}} renders illustrated keys and keystrokes.

mark

<mark>...</mark> represents a run of text in one document marked or highlighted for reference purposes, due to its relevance in another context. Marked text is formatted with a yellow background by default.

Markup Renders as
<mark>HyperText Markup Language</mark>

HyperText Markup Language

<mark style="background:lightblue;">HyperText Markup Language</mark>

HyperText Markup Language

Support: Not supported by Internet Explorer 8 and below.

pre

<pre>...</pre> element represents a block of preformatted text. In MediaWiki, <pre> is actually a parser tag and not HTML, but the function is the same. It also prevents the parsing of templates.

Markup Renders as[3]
<pre>HyperText Markup Language</pre>
HyperText Markup Language
HTML entities

<pre> parses HTML entities. If you want to escape this, replace & with &amp;, or use <syntaxhighlight lang="text"> instead.

Markup Renders as[3]
<pre>&amp;</pre>
&
<pre>&lt;</pre>
<
<pre>&amp;amp;</pre>
&amp;
<pre>&amp;lt;</pre>
&lt;

Templates:

  • {{pre}} wraps text that overflows the page.

q

<q>...</q> is used to mark a short quotation. There has been very little implementation of this element in Wikipedia yet.

Markup Renders as
<q>HyperText Markup Language</q>

HyperText Markup Language

MOS:QUOTATIONS says Wikipedia should instead use "", {{quote}}, or <blockquote>.

rp, rt, ruby

<ruby>...</ruby> marks spans of phrasing content with ruby annotations.

  • <rt>...</rt> marks the ruby text component of a ruby annotation; the ruby text shows in a reduced size over top of the normal characters.
  • <rp>...</rp> is used to provide parentheses around a ruby text component of a ruby annotation, to be shown by user agents that don't support ruby annotations.

Browsers that do not support ruby characters will show the ruby text in normal size, enclosed in parentheses and after the normal content.

Markup Renders as
<ruby><rp>(</rp><rt>とう</rt><rp>)</rp><rp>(</rp><rt>きょう</rt><rp>)</rp>
</ruby>

(とう)(きょう)

Templates:

s

<s>...</s> is used to indicate content that is no longer accurate or relevant and that has been struck from the page. It is not appropriate when indicating document edits; to mark a span of text as having been removed from a document, use <del>.

Markup Renders as
<s>HyperText Markup Language</s>

HyperText Markup Language

Templates: {{strikethrough}}

samp

<samp>...</samp> indicates sample output from a program or computing system. Examples include: output of a program, script, or Wikipedia template; status displays or audio announcements made by an app or device; file system directory listings and samples from them, such as paths and file names.

Markup Renders as
sample output: <samp>HTML</samp>

sample output: HTML

Templates: {{samp}} applies monospace styling, and gives the text in dark grey to distinguish from code (<code>) and input (<kbd> or {{kbd}}).

small

<small>...</small> format small text.

Markup Renders as
<small>HyperText Markup Language</small>

HyperText Markup Language

Templates:

  • {{small}} uses <span style="font-size:85%;">. {{small}} is recommended over <small> since <small>...</small> has a semantic meaning that is for fine print, whereas {{small}} is purely stylistic.

strong

<strong>...</strong> formats a span of text with strong importance or unusual emphasis; in most browsers it renders as boldface. This should generally not be used in Wikipedia articles, per WP:Neutral point of view policy. See MOS:BOLD on use of this element and other boldfacing. Most semantic emphasis, including in quoted material, should be rendered with the <em> element.

Markup Renders as
<strong>HyperText Markup Language</strong>

HyperText Markup Language

Templates: {{strong}}

sub

<sub>...</sub> formats a span of text as a subscript.

Markup Renders as
HyperText <sub>Markup Language</sub>

HyperText Markup Language

Templates:

  • {{sub}} (subscript text)
  • {{subsub}} (subscript subscript text)
  • {{ssub}} (subscript, small text)
  • {{sup}} (superscript text)
  • {{su}} (superscript
    subscript
    text)
  • {{sup sub}} (textsup
    sub
    )
  • {{e}} (1.23×104)

sup

<sup>...</sup> formats a span of text as a superscript.

Markup Renders as
HyperText <sup>Markup Language</sup>

HyperText Markup Language

Templates:

  • {{sub}} (subscript text)
  • {{subsub}} (subscript subscript text)
  • {{ssub}} (subscript, small text)
  • {{sup}} (superscript text)
  • {{su}} (superscript
    subscript
    text)
  • {{sup sub}} (textsup
    sub
    )
  • {{e}} (1.23×104)

time

<time>...</time> defines either a time (24 hour clock), or a date in the Gregorian calendar, optionally with a time and a time-zone offset.

Markup Renders as
<time>10:00</time>

Attributes: datetime

Support: Not supported by Internet Explorer 8 and below.

u

<u>...</u> represents a span of text offset from its surrounding content without conveying any extra emphasis or importance, and for which the conventional typographic presentation is underlining; for example, a span of text in Chinese that is a proper name (a Chinese proper name mark), or span of text that is known to be misspelled.

<u> was presentational element of HTML that was originally used to underline text; this usage was deprecated in HTML4 in favor of the CSS style {text-decoration: underline}.[4] In HTML5, the tag reappeared but its meaning was changed significantly: it now "represents a span of inline text which should be rendered in a way that indicates that it has a non-textual annotation".[4] This facility is intended for example to provide a red wavy line underline to flag spelling errors at input time but which are not to be embedded in any stored file (unlike an emphasis mark, which would be).

Markup Renders as
<u>HyperText Markup Language</u>

HyperText Markup Language

Templates: {{underline}} (which supplies the recommended CSS style)

var

<var>...</var> formats text in italics to indicate a variable in a mathematical expression or programming context, or placeholder text that the reader is meant to mentally replace with some other literal value.

Markup Renders as
*<var>E</var>=<var>m</var>c<sup>2</sup> (c is a constant not a variable)
*<code><nowiki>{{</nowiki><var>TemplateName</var>|<var>parameter</var>=<var>value</var><nowiki>}}</nowiki></code>
*If <var>A</var> then <var>B</var>
  • E=mc2 (c is a constant not a variable)
  • {{TemplateName|parameter=value}}
  • If A then B

Templates:

  • {{var}}
  • {{varserif}} formatted in italic serif to differentiate characters

wbr

<wbr> is a word break opportunity; that is, it specifies where it would be OK to add a line-break where a word is too long, or it is perceived that the browser will break a line at the wrong place.

Markup Renders as
Now is the time to become a power editor, by learning HyperText Markup Language

Now is the time to become a power editor, by learning HyperText Markup Language

Now is the time to become a power editor, by learning Hyper<wbr>Text Markup Language

Now is the time to become a power editor, by learning HyperText Markup Language

As the browser window is adjusted narrower, the second example wraps between Hyper and Text.

Lists

Do not leave blank lines between items in a list unless there is a reason to do so, since this causes the MediaWiki software to interpret each item as beginning a new list.

dl, dt, dd

<dl>...</dl>, <dt>...</dt> and <dd>...</dd> are used to create a description list (formerly definition list) with terms and descriptions. Terms are displayed in bold and descriptions are indented. Each term must include one or more descriptions.

Markup Renders as
<dl>
<dt>Term</dt>
<dd>Definition 1</dd>
<dd>Definition 2</dd>
</dl>
Term
Definition 1
Definition 2

Wikimarkup: <dt> is created using ; while automatically enclosed in <dl>...</dl>. <dd> is created using : for each value. For a single or first value the : can be placed on the same line after ; where subsequent values must be placed on separate lines.

Markup Renders as
; Term
: Definition 1
: Definition 2
Term
Definition 1
Definition 2

Templates: {{defn}}

ol, ul, li

<ol>...</ol> represents an ordered list; <ul>...</ul> represents an unordered list; <li>...</li> represents a list item within either type of list.

Markup Renders as
<ol>
<li>Item 1</li>
<li>Item 2</li>
</ol>
  1. Item 1
  2. Item 2
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
  • Item 1
  • Item 2

Wikimarkup: use * for items in an unordered list and # for ordered lists.

Markup Renders as
# Item 1
# Item 2

  1. Item 1
  2. Item 2
* Item 1
* Item 2

  • Item 1
  • Item 2

Templates: for a variety of specialized uses, see Category:List formatting and function templates.

Containers

div

<div>...</div> is a generic container for flow content that displays as a block element.

Markup Renders as
HyperText <div>Markup</div> Language
HyperText
Markup
Language

span

<span>...</span> is a container for flow content that displays as an inline element.

Markup Renders as
HyperText <span>Markup</span> Language

HyperText Markup Language

Tables

table, td, tr

<table>...</table> defines a table.

  • <tr>...</tr> defines a table row.
  • <td>...</td> defines a data cell with contents that may include text, links, images, lists, forms, other tables, etc.
Markup Renders as
<table border=1>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table>
data data

Attributes:

  • <table>:
    Allowed but not recommended: border="" and border="1"
    Allowed but obsolete: border (with a non-empty value different from "1"), align, bgcolor, cellpadding, cellspacing, frame, rules, summary, width[5]
  • <td>: colspan, headers, rowspan
    Allowed but obsolete: abbr, align, axis, bgcolor, scope, height, nowrap, valign, width[5]

th

<th>...</th> defines a table header; styled as centered and bold.

Markup Renders as
<table border="1">
<tr>
<th>Header</th>
<th>Header</th>
</tr>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table>
Header Header
data data

Attributes:

  • <th>: colspan, headers, rowspan, scope
    Allowed but obsolete: abbr, align, axis, bgcolor, height, nowrap, valign, width[5]

caption

<caption>...</caption> adds a caption to a table.

Markup Renders as
<table border=1>
<caption>Caption</caption>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table>
Caption
data data

Attributes:

  • <caption>:
    Allowed but obsolete: align[5]

thead, tfoot, tbody

<thead>, <tfoot> and <tbody> are not supported, but are automatically generated when the page is rendered.

Obsolete/deprecated elements

These elements are now obsolete and either deprecated or removed in HTML5, but still supported by browsers.[5] These tags should not be used on Wikipedia. These tags either have an alternate tag or a template that replaces their function with CSS. See Wikipedia:HTML5 § Obsolete elements and attributes for more details on obsolete HTML parts and their replacements.

center

<center>...</center> (obsolete) is used to center text elements.

Templates: {{center}} uses CSS.

font

<font>...</font> (obsolete) is used to set the font size, font face and color of text.

Templates: {{font}} uses CSS.

rb

<rb>...</rb> (obsolete) Used to mark base text in a ruby annotation

For replacements, see: Help:HTML in wikitext#rp, rt, ruby

strike

<strike>...</strike> (obsolete) formats strike-through characters; use <s> instead.

tt

<tt>...</tt> (obsolete) formats text in a fixed-width font. Use <code>, <kbd> or <samp> instead.

Templates: {{mono}} uses CSS.

Unsupported elements

These elements are not supported, but have equivalent wiki markup. Attempting to use any element not whitelisted by Sanitizer.php will result in the markup showing as plain text.

a

<a> is used to create links. Use the [[ ]] wikimarkup for internal/intrawiki links and interwiki links, and [ ] for external links.

input

<input> is used to create forms. The <inputbox> extension tag is used to create a text box with a button.

HTML Tidy

HTML Tidy is an outdated HTML4 library that is slated for removal. Tidy parses the MediaWiki output and cleans it up to increase the likelihood that valid HTML4 is rendered. For example, with Tidy enabled, <br>, </br>, <br/>, <br.> all rendered as <br />. Tidy is not enabled for MediaWiki interface pages. Tidy was never perfect and has been known to introduce errors.

Exceptions

In some pages in the MediaWiki namespace, typically the short messages like button labels, HTML is not parsed, and tags will be exposed.

User and sitewide CSS and JavaScript pages are interpreted as if inside a <pre> block. See Help:User style.

Validation

The MediaWiki software attempts to fix HTML errors, but it does not catch all of them. Where HTML is used, it is helpful to verify it with the W3C Markup Validation Service.

Parser and extension tags

For a machine-generated list, see Special:Version#mw-version-parser-extensiontags. It may include tags not documented here.

Parser tags
<gallery>, <includeonly>, <noinclude>, <nowiki>, <onlyinclude>, <pre>
Extension tags
<categorytree>, <charinsert>, <chem> (alias <ce>), <graph>, <hiero>, <imagemap>, <indicator>, <inputbox>, <mapframe>, <maplink>, <math>, <math chem>, <poem>, <ref>, <references>, <score>, <section>, <syntaxhighlight> (alias <source>), <templatedata>, <templatestyles>, <timeline>

See also

References

  1. ^ a b Allowable elements and attributes are defined in the Sanitizer.php module.
  2. ^ "The microdata model". HTML Living Standard.
  3. ^ a b c For the table cell a white background color was chosen here for a better display of the light gray background.
  4. ^ a b "<u>: The Unarticulated Annotation (Underline) element". mozilla.org. 1 August 2020. Retrieved 9 October 2020.
  5. ^ a b c d e "HTML5: A vocabulary and associated APIs for HTML and XHTML: Obsolete Features". W3C. 31 July 2014.

External links

Leave a Reply