Help:HTML in wikitext: Difference between revisions

Content deleted Content added
Obsolete/deprecated elements: big is not obsolete in Linter
 
(592 intermediate revisions by more than 100 users not shown)
Line 1:
{{Short description|Usage of HTML tags with MediaWiki}}
{{shortcut|H:HTML}}
<noinclude>{{pp-semi-indef|small=yes}}</noinclude>
For many HTML elements, more convenient wikitext code is available, see [[Help:Wiki markup]], however there are some situations in which the HTML alternative is useful, for example creating an link to a particular element of a table.
 
{{Redirect|WP:HTML|general information about the default markup language on Wikipedia|Wikipedia:HTML5}}{{For|wikitext equivalents to HTML tags|Help:Wikitext}}{{Locutions pages header}}
==Permitted HTML==
{{Wikipedia how to|H:HTML|WP:HTML}}
The following [[HTML element]]s are currently permitted:
{{Colbegin|3}}
* [[HTML element#General|&lt;abbr&gt;]]
**Marks an abbreviation, and can make the full form available: <abbr title="abbreviation">abbr.</abbr>
* [[HTML element#Presentation|&lt;b&gt;]]
**<b>Sets font to boldface where possible</b>
* [[HTML element#Presentation|&lt;big&gt;]]
**<big>Increases</big> font size
* [[HTML element#Other block elements|&lt;blockquote&gt;]]
**A block-level quotation, <blockquote>for when the quotation includes block level elements,</blockquote> e.g. paragraphs
* [[HTML element#Other inline elements|&lt;br&gt;]]
**A forced<br/> line-break
* [[HTML element#Tables|&lt;caption&gt;]]
**<table><caption>Specifies a caption for a table</caption></table>
* [[HTML element#Other block elements|&lt;center&gt;]]
**<center>Creates a block-level center-aligned division</center> Use <code>&lt;div&gt;</code> instead
* [[HTML element#Other inline elements|&lt;cite&gt;]]
**<cite>A citation</cite>
* [[HTML element#Computer phrase elements|&lt;code&gt;]]
**<code>A code snippet</code>
* [[HTML element#Lists|&lt;dd&gt;]]
**<dl><dd>The definition of a term,</dd><dd>in a definition list</dd></dl>
* [[HTML element#Other block elements|&lt;del&gt;]]
**<del>Deleted text</del>
* [[HTML element#Other block elements|&lt;div&gt;]]
**<div>A block-level logical division</div>
* [[HTML element#Lists|&lt;dl&gt;]]
**<dl>A definition list (consisting of definition terms paired with definitions)</dl>
* [[HTML element#Lists|&lt;dt&gt;]]
**<dl><dt>A definition term</dt><dt>in a definition list</dt></dl>
* [[HTML element#General|&lt;em&gt;]]
**<em>Emphasis</em>
* [[HTML element#Presentation|&lt;font&gt;]]
**<font color="green" size="-1" face="Courier">Can specify the font color with the color attribute, typeface with the face attribute, and absolute or relative size with the size attribute.</font> use <nowiki><span></nowiki> instead
* [[HTML element#Basic text|&lt;h1&gt;]] - [[HTML element#Basic text|&lt;h6&gt;]]
**<nowiki><h1>Section headings at different levels.</h1></nowiki>
* [[HTML element#Other block elements|&lt;hr&gt;]]
**<hr>A horizontal rule</hr>
* [[HTML element#Presentation|&lt;i&gt;]]
**<i>Sets font to italic where possible</i>
* [[HTML element#Other block elements|&lt;ins&gt;]]
**<ins>Inserted text</ins>
* [[HTML element#Lists|&lt;li&gt;]]
**<li>A list item in ordered (ol)</li><li>or unordered (ul) lists</li>
* [[HTML element#Lists|&lt;ol&gt;]]
**<ol><li>An ordered...</li><li>(enumerated) list</li></ol>
* [[HTML element#Basic text|&lt;p&gt;]]
**Creates a <p>paragraph,</p> perhaps the most common block level element
* [[HTML element#Other block elements|&lt;pre&gt;]]
**a <pre>Pre-formatted text</pre> b
* [[Ruby character#Ruby markup|&lt;rb&gt;]]
**東 vs <ruby style="font-size:1.2em;"><rb>東</rb></ruby>
* [[Ruby character#Ruby markup|&lt;rp&gt;]]
**( vs <ruby style="font-size:1.2em;"><rp>(</rp></ruby>
* [[Ruby character#Ruby markup|&lt;rt&gt;]]
**とう vs <ruby style="font-size:1.2em;"><rt>とう</rt></ruby>
* [[Ruby character#Ruby markup|&lt;ruby&gt;]]
**東(とう)京(きょう) vs <ruby style="font-size:1.2em;"><rb>東</rb><rp>(</rp><rt>とう</rt><rp>)</rp></ruby>
<ruby style="font-size:1.2em;"><rb>京</rb><rp>(</rp><rt>きょう</rt><rp>)</rp></ruby>
* [[HTML element#Presentation|&lt;s&gt;]]
**<s>Strike-through text</s>
* [[HTML element#Presentation|&lt;small&gt;]]
**<small>Decreases</small> font size
* [[HTML element#Span|&lt;span&gt;]]
**<span>An inline logical division</span>
* [[HTML element#Presentation|&lt;strike&gt;]]
**<s>Strike-through text</s>
* [[HTML element#General|&lt;strong&gt;]]
**
* [[HTML element#Other inline elements|&lt;sub&gt;]]
**Mark<sub>subscript</sub>
* [[HTML element#Other inline elements|&lt;sup&gt;]]
**Mark<sup>superscript</sup>
* [[HTML element#Tables|&lt;table&gt;]]
**<table>Identifies a table</table>
* [[HTML element#Tables|&lt;td&gt;]]
**<table><td>A table data cell</td></table>
* [[HTML element#Tables|&lt;th&gt;]]
**<table><th>A table header cell; contents are conventionally displayed bold and centered</th></table>
* [[HTML element#Tables|&lt;tr&gt;]]
**<table><tr>Contains a row of cells in a table</tr></table>
* [[HTML element#Presentation|&lt;tt&gt;]]
**<tt>Fixed-width font</tt>
* [[HTML element#Presentation|&lt;u&gt;]]
**<u>Underlines text</u>
* [[HTML element#Lists|&lt;ul&gt;]]
**<ul><li>An unordered...</li><li>(bulleted) list</li></ul>
* [[HTML element#Computer phrase elements|&lt;var&gt;]]
**<var>Variable</var>
* [[HTML element#Comments|&lt;!-- ... --&gt;]]
**<nowiki><!--Comment--></nowiki>
{{Colend}}
 
{{Wiki markup}}
==Anchors==
HTML tags allow an <code>id</code> attribute that can be referenced in one's [[Help:User style|user style]] CSS, and allows the element to be used as link target.
 
The [[MediaWiki]] software, which drives Wikipedia, allows the use of a subset of [[HTML5]] [[HTML element|elements]], or tags and their [[HTML attribute|attributes]], for presentation formatting.{{r|sanitizer}} However, most HTML functionality can be replicated using equivalent [[Help:Wiki markup|wiki markup]] or [[Help:Templates|templates]]. These alternatives are generally preferred within articles because they are often simpler for most editors to use and less intrusive in the editing interface. [[Wikipedia:Manual_of_Style#Keep_markup_simple|Wikipedia's Manual of Style]] recommends when and where these alternatives should be used. (See [[Help:Wikitext]] for wikitext equivalents to HTML tags not otherwise discussed below.)
However, the anchor element <code>a</code> is not allowed, so the wikitext
<code><nowiki><a href="http://meta.wikimedia.org/">Main Page</a></nowiki></code>
is treated like the wikitext
<code><nowiki>&amp;lt;a href="http://meta.wikimedia.org/"&amp;gt;Main Page&amp;lt;/a&amp;gt;</nowiki></code>
and is therefore displayed as
{{Quote|1=<a href="http://meta.wikimedia.org/">Main Page</a>}}
which is unlikely to be what the editor intended. Instead of using the anchor element (&lt;a&gt;) the wiki markup for external reference is required (enclosed in square brackets with the URL separated from the contents by a single space):
<code><nowiki>[http://meta.wikimedia.org/ Main Page]</nowiki></code>
displays as
{{Quote|[http://meta.wikimedia.org/ Main Page]}}
 
HTML can also be useful outside articles, such as for formatting within templates. For assistance with using Cascading Style Sheets on Wikipedia, see [[Help:Cascading Style Sheets]].
The following excerpt from [http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/Sanitizer.php?view=markup Sanitizer.php] additionally shows which attributes are allowed.
 
Some tags that resemble HTML are actually MediaWiki [[#Parser and extension tags|parser and extension tags]], and so are actually wiki markup. HTML included in pages can be validated for HTML5 compliance by using [[#Validation|validation]]. Note that some elements and attributes supported by MediaWiki and browsers have been [[Wikipedia:HTML5|deprecated by HTML5]] and should no longer be used.{{TOC limit|3}}
<source lang="php">
$htmlpairsStatic = array( # Tags that must be closed
'b', 'del', 'i', 'ins', 'u', 'font', 'big', 'small', 'sub', 'sup', 'h1',
'h2', 'h3', 'h4', 'h5', 'h6', 'cite', 'code', 'em', 's',
'strike', 'strong', 'tt', 'var', 'div', 'center',
'blockquote', 'ol', 'ul', 'dl', 'table', 'caption', 'pre',
'ruby', 'rt' , 'rb' , 'rp', 'p', 'span', 'u', 'abbr'
);
$htmlsingle = array(
'br', 'hr', 'li', 'dt', 'dd'
);
$htmlsingleonly = array( # Elements that cannot have close tags
'br', 'hr'
);
$htmlnest = array( # Tags that can be nested--??
'table', 'tr', 'td', 'th', 'div', 'blockquote', 'ol', 'ul',
'dl', 'font', 'big', 'small', 'sub', 'sup', 'span'
);
$tabletags = array( # Can only appear inside table, we will close them
'td', 'th', 'tr',
);
$htmllist = array( # Tags used by list
'ul','ol',
);
$listtags = array( # Tags that can appear in a list
'li',
);
</source>
 
== TagsTutorials ==
This help page gives only an overview of allowed markup. For further assistance and detailed specifications:
 
* [https://developer.mozilla.org/en-US/docs/Learn/HTML HTML5 Introduction] at developer.mozilla.org
{{mlw|HTML element|Span|<code>'''&lt;span>'''</code>}} is a generic inline text container.
* [https://www.w3schools.com/html/default.asp HTML5 Introduction] at w3schools.com
 
== Attributes ==
<code>'''&lt;font>'''</code> is a similar tag which is [[deprecation|deprecate]]d (should not be used) in favor of <nowiki><span></nowiki>.''
[[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}}:
For example
* <code>class</code>: one or more classifications to which the element belongs. See [[Wikipedia:Catalogue of CSS classes]].
<source lang=html4strict>
* <code>dir</code>: text direction— <code>"ltr"</code> (left-to-right), <code>"rtl"</code> (right-to-left) or <code>"auto"</code>.
a <font color="red">red</font> word.
* <code>id</code>: unique identifier for the element.
</source>
* <code>lang</code>: primary language for the contents of the element per [[BCP 47]].
produces the same result as
* <code>style</code>: applies CSS styling to the contents of the element.
<source lang=html4strict>
* <code>title</code>: advisory information associated with the element.
a <span style="color:red">red</span> word.
</source>
 
HTML5 microdata attributes apply to all tags:{{r|html5microdata}}
See also {{tim|font size demo}} and [[m:Help:Text color]].
* Any attribute beginning with <code>data-</code>
* <code>itemid</code>
* <code>itemprop</code>
* <code>itemref</code>
* <code>itemscope</code>
* <code>itemtype</code>
 
<!-- As of 10 January 2013, $wgAllowRdfaAttributes is not enabled, thus the attributes will be stripped
It's pointless to combine the legacy tag <tt>&lt;font&gt;</tt>
[[RDFa]] attributes:{{r|rdfa}}
with inline CSS; legacy browsers would ignore the CSS, while
* <code>about</code>
modern browsers support <tt>&lt;span&gt;</tt> (see above).
* <code>property</code>
* <code>resource</code>
* <code>datatype</code>
* <code>typeof</code>
-->
Other tags such as {{tag|table|o}} support specific attributes – these are listed in the appropriate section.
 
{{markup
Note that in most cases, one can use a more descriptive tag, for instance, <strong><nowiki><strong></nowiki></strong> to indicate an important piece of text, or <em><nowiki><em></nowiki></em> (subject to the same things as strong) to indicate an emphasized piece of text.
|<syntaxhighlight lang="html">This is <span style="color:red;">red</span> text.</syntaxhighlight>
|2=This is <span style="color:red;">red</span> text.
}}
 
The MediaWiki {{sanitizer.php}} does some cleanup on attributes. A best practice is to use the proper syntax.
This not only draws the user's attention to the text, but can also alert those who are using nonvisual browsers or have sight impairments, etc. to the fact that that is <em>emphasized text</em>.
* 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 ==
===Using <nowiki><span></nowiki> as a link target===
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 ===
The standard way of providing a named anchor as an invisible target (i.e. <code><a name="Foo"></code>) doesn't work (since all <code><a></code> tags are converted), and [http://www.w3.org/TR/html401/struct/links.html an alternative suggested by the W3C], <code><nowiki><hN id="Foo"></hN></nowiki></code>, produces an "[Edit]" link.
 
==== h1, h2, h3, h4, h5, h6 ====
However, <code><nowiki><span id="Foo"></nowiki></code> does produce a target that can be the destination of a link. Note that it doesn't work everywhere; for instance, in a table, it has to be inside a cell before some browsers will jump to it properly.
{{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 [[Help:Cascading Style Sheets#Wiki headings|styled through CSS]] and added to the page's [[Help:table of contents|table of contents]].
 
{{markup
===<nowiki><div></nowiki>===
|<nowiki><h1>Heading 1</h1>
<code>'''&lt;div>'''</code> is a generic block container. Rules:
<h2>Heading 2</h2>
* <nowiki><div></nowiki> should be followed by a newline
<h3>Heading 3</h3>
* <nowiki></div></nowiki> should be preceded by a newline
<h4>Heading 4</h4>
*<nowiki></div></nowiki> followed by text on the same line, two newlines and text before <nowiki><div></nowiki> on the same line should be avoided (because the two newlines only produce a space)
<h5>Heading 5</h5>
<h6>Heading 6</h6></nowiki>
|{{fakeheading|sub=1|Heading 1}}
{{fakeheading|sub=2|Heading 2}}
{{fakeheading|sub=3|Heading 3}}
{{fakeheading|sub=4|Heading 4}}
{{fakeheading|sub=5|Heading 5}}
{{fakeheading|sub=6|Heading 6}}
}}
 
Wikimarkup: surround the text with the appropriate number of equal signs. Headers formatted with wikimarkup add an [edit] link.
===HTML comment===
<section begin="WIKI_section" />
Using {{tim|t}}:
{{markup
*{{xpd|t}}
|<nowiki>= Heading 1 =
*"<code><nowiki>{{subst:xpd|t}}</nowiki>"</code> gives "&lt;!--t-->start-pqr-end", producing HTML code without the comment.
== Heading 2 ==
The "Remove comments" option of [[mw:Extension:ExpandTemplates|ExpandTemplates]] selects whether comments are removed, not just in the final result but throughout the expansion process. This affects the result of parser functions: a comment in the expression of #expr or in the condition of #ifexpr gives an error message unless "Remove comments" is on, and comments affect #if and #ifeq.
=== Heading 3 ===
==== Heading 4 ====
===== Heading 5 =====
====== Heading 6 ======
</nowiki>|{{fake heading|sub=1|Heading 1}}
{{fake heading|sub=2|Heading 2}}
{{fake heading|sub=3|Heading 3}}
{{fake heading|sub=4|Heading 4}}
{{fake heading|sub=5|Heading 5}}
{{fake heading|sub=6|Heading 6}}
}}
<section end="WIKI_section" />
 
Templates: {{tlx|fake heading}} for use in documentation
Example:
 
==== p ====
Wikitext:
{{tag|p}} tag places content into a separate paragraph.
 
{{markup
|<nowiki><p>HyperText Markup Language</p><p>HyperText Markup Language</p></nowiki>
|<p>HyperText Markup Language</p><p>HyperText Markup Language</p>
}}
 
Wikimarkup: Separate paragraphs by a single blank line.
 
{{markup
|<nowiki>HyperText Markup Language
 
HyperText Markup Language</nowiki>
|HyperText Markup Language
 
HyperText Markup Language
}}
 
{{tag|p}} is especially useful in lists, for list items with multiple paragraphs:
 
{{markup|<syntaxhighlight lang="tid">
* <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
|<nowiki>HyperText<br>Markup Language</nowiki>
|HyperText<br>Markup Language
}}
 
Templates:
* {{tlx|break}} adds multiple line breaks.
* {{tlx|crlf2}} adds a true carriage return and line feed.
* {{tlx|clear}} adds a break with styling to clear floating elements.
* {{tlx|plainlist}} creates an unbulleted list.
 
==== hr ====
{{see|WP:LINE}}
{{tag|hr|o}} or {{tag|hr|s}} represents a paragraph-level thematic break and presents as a horizontal rule.
 
{{markup
|<nowiki><hr /></nowiki>
|<hr />
}}
 
Wikimarkup: use <code>----</code>
{{markup
|<nowiki>----</nowiki>
|{{crlf2}}
----
}}
<pre>
{{#expr:<!--p-->3}}
 
Templates: {{tlx|hr}}
{{#ifeq:<!--p-->3|3|1|0}}
 
==== Comments ====
{{#if:<!--p-->|1|0}}
{{see|MOS:COMMENT}}
{{tag|!--}} formats the enclosed text as a hidden comment.
 
{{markup
|<nowiki>HyperText<!--Markup Language--></nowiki>
|HyperText<!--Markup Language-->
}}
 
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|<nowiki>Content line 1
 
<!-- 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
|<nowiki><abbr title="HyperText Markup Language">HTML</abbr></nowiki>
|2=<abbr title="HyperText Markup Language">HTML</abbr>
}}
 
Templates: {{tlx|abbr}}
 
==== b ====
{{see|MOS:BOLD}}
{{tag|b}} formats text stylistically offset from other text (bold) without conveying extra importance.
 
{{markup
|<nowiki><b>HyperText Markup Language</b></nowiki>
|<b>HyperText Markup Language</b>
}}
 
Wikimarkup: Use <code><nowiki>'''</nowiki></code> to open and close bold text.
 
{{markup
|<nowiki>'''HyperText Markup Language'''</nowiki>
|'''HyperText Markup Language'''
}}
 
==== bdi ====
 
{{tag|bdi}} isolates the content from the surrounding text-direction settings.
 
{{markup
|<nowiki>اليمين إلى اليسارleft to right
</nowiki>
|اليمين إلى اليسارleft to right
 
|<nowiki>اليمين إلى اليسار<bdi>left to right</bdi></nowiki>
|اليمين إلى اليسار<bdi>left to right</bdi>
}}
 
Support: Firefox, Chrome
 
==== bdo ====
{{tag|bdo}} specifies the text direction.
 
Attributes and values:
* <code>dir</code> – Specifies the text direction.
** <code>ltr</code>
** <code>rtl</code>
 
{{markup
|1=<nowiki><bdo dir="rtl">HyperText Markup Language</bdo></nowiki>
|2=<bdo dir="rtl">HyperText Markup Language</bdo>
}}
 
==== blockquote ====
{{see|MOS:QUOTE}}
{{tag|blockquote}} presents text in an offset block.
 
{{markup
|<nowiki><blockquote>HyperText Markup Language</blockquote></nowiki>
|<blockquote>HyperText Markup Language</blockquote>
}}
 
Templates: {{tlx|quote}}; supports pre-formatted attribution and source parameters. For other specialized quotation templates, see [[:Category:Quotation templates]].
 
==== cite ====
{{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
|<nowiki><cite>HyperText Markup Language</cite></nowiki>
|<cite>HyperText Markup Language</cite>
}}
 
{{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. 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
|<nowiki>use <code>this code</code></nowiki>
|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: {{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 ====
{{tag|data}} formats a machine-readable version of contents.
 
{{markup
|<nowiki><data value="978-0764502149">HTML for Dummies</data></nowiki>
|2=<data value="978-0764502149">HTML for Dummies</data>
}}
 
Attributes: <code>value</code>
 
==== del ====
{{tag|del}} formats deleted text.
 
{{markup
|<nowiki><del>HyperText Markup Language</del></nowiki>
|<del>HyperText Markup Language</del>
}}
 
==== dfn ====
{{tag|dfn}} is used for indicating the defining instance of a term.
 
{{markup
|<nowiki><dfn>Definition</dfn></nowiki>
|<dfn>Definition</dfn>
}}
 
Templates: {{tlx|dfn}}
 
==== em ====
{{see|MOS:ITALIC}}
{{tag|em}} represents a span of text with emphatic stress (i.e. semantic emphasis). In most browsers, it renders as italic.
 
{{markup
|<nowiki><em>HyperText Markup Language</em></nowiki>
|<em>HyperText Markup Language</em>
}}
 
Templates: {{tlx|em}}
 
==== i ====
{{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.
 
{{markup
|<nowiki><i>HyperText Markup Language</i></nowiki>
|<i>HyperText Markup Language</i>
}}
 
Wikimarkup: Use <code><nowiki>''</nowiki></code> to open and close italic text.
{{markup
|<nowiki>''HyperText Markup Language''</nowiki>
|''HyperText Markup Language''
}}
 
==== 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]].
 
{{markup
|<nowiki><ins>HyperText Markup Language</ins></nowiki>
|<ins>HyperText Markup Language</ins>
}}
 
==== kbd ====
{{tag|kbd}} indicates user input such as keyboard input or voice commands (but ''no'' {{kbd|gray background}} as with the template {{tlx|kbd}}).
 
{{markup
|<nowiki>Press <kbd>Enter</kbd></nowiki>
|Press <kbd>Enter</kbd>
}}
 
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}}).
* {{tlx|key press}} renders illustrated keys and keystrokes.
 
==== 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.
 
{{markup
|<nowiki><mark>HyperText Markup Language</mark></nowiki>
|<mark>HyperText Markup Language</mark>
|<nowiki><mark style="background:lightblue;">HyperText Markup Language</mark></nowiki>
|4=<mark style="background:lightblue;">HyperText Markup Language</mark>
}}
 
Support: Not supported by Internet Explorer 8 and below.
 
==== 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. It also prevents the parsing of templates.
 
{{markup
|<nowiki><pre>HyperText Markup Language</pre></nowiki>
|col2=Renders as<ref name="white bgcolor"/>
|col2style=background-color:#fff
 
|<pre>
HyperText Markup Language
</pre>
}}
----
Result of normal expansion, and of ExpandTemplates with "Remove comments" on:
----
{{#expr:<!--p-->3}}
 
===== HTML entities =====
{{#ifeq:<!--p-->3|3|1|0}}
 
{{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.
{{#if:<!--p-->|1|0}}
----
Result of full substitution, and of ExpandTemplates with "Remove comments" off:
----
0
 
{{markup
0
|<nowiki><pre>&amp;amp;</pre></nowiki>
|col2=Renders as<ref name="white bgcolor"/>
|col2style=background-color:#fff
 
|<pre>
1
&amp;
----
</pre>
Therefore it is typically better to avoid comments in these places, and to put the comment before or after the parser function.
|<nowiki><pre>&amp;lt;</pre></nowiki>
 
In the case of nested parser functions, to avoid having to put the comments outside the whole, an alternative is <nowiki>{{void|</nowiki>''comment''}}. In the case of substitution of the parser function, "void" has to be substituted too, e.g. in a template allowing multi-level substitution we can put <nowiki>{{{{{subst1|}}}#expr:3*{{{1}}} {{{{{subst1|}}}void|</nowiki> multiply by 3 }}}}.
 
|<pre>
Another alternative is making the comment the name of a parameter (in the likely case that it is unused), with the empty string as default, e.g. <nowiki>{{{ multiply by 3 |}}} or, to recognize the intention, use pseudo comment tags: {{{<!- multiply by 3 ->|}}}, or real ones, if the empty string is not used as parameter: {{{<!-- multiply by 3 -->|}}}</nowiki>.
&lt;
</pre>
|<nowiki><pre>&amp;amp;amp;</pre></nowiki>
 
See also {{tim|t comment}}.
 
|<pre>
== Attributes ==
&amp;amp;
</pre>
|<nowiki><pre>&amp;amp;lt;</pre></nowiki>
 
Most tags can have a <tt>style</tt> attribute. For example
<source lang=html4strict>
<div style="font-size:80%">
This is <span style="color:red">red</span> text.
</div>
</source>
produces:
<blockquote style="border:1px dotted gray; padding-left:20px">
<div style="font-size:80%">
This is <span style="color:red">red</span> text.
</div>
</blockquote>
 
|<pre>
Most tags can have classes and IDs. They can be used in conjunction with stylesheets to give a piece of text a descriptive class (or unique identifier) and to refer to that in a stylesheet.
&amp;lt;
For example
</pre>
}}
 
Templates:
<source lang=html4strict>
* {{tlx|pre}} wraps text that overflows the page.
<div class="infobox">Example infobox</div>
</source>
 
==== q ====
<div class="infobox">Example infobox</div>
{{tag|q}} is used to mark a short quotation. There has been very little implementation of this element in Wikipedia yet.
Produces the box which floats on the right because <tt>infobox</tt> class is already defined in local [[Mediawiki:Common.css]].
<br style=clear:all>
 
{{markup
Classes and IDs can also be used by Javascript code, for example see [[:en:Template_talk:Link_FA#How_does_it_work.3F|how {Link FA} works]] in enwiki.
|<nowiki><q>HyperText Markup Language</q></nowiki>
|<q>HyperText Markup Language</q>
}}
 
[[MOS:QUOTATIONS]] says Wikipedia should instead use "", {{tl|quote}}, or <nowiki><blockquote></nowiki>.
Classes are also widely used to create [[microformat]]s. See [[WP:UF|the microformats project]] for more information. Some [[Wikipedia:WikiProject Microformats/classes|class names are reserved]] for use in microformats.
 
==== rp, rt, rtc, ruby ====
Another attribute example is <tt>title</tt>, for example used in {{tl|H:title}} template: note the hover box over "20000 ft"
<blockquote style="border:1px dotted gray; padding-left:20px">
"a height of {{h:title|6.1 km|20000 ft}} above sea level"
</blockquote>
 
{{see|Ruby character}}
<!--
This is suitable if the color is specifically intended to be red; if it is just for emphasis a more general term for the class would be more appropriate, because css allows the user to choose another method of emphasis (another color, bold, enlarged, etc.).
 
{{tag|ruby}} marks spans of phrasing content with ruby annotations.
Note that many readers will not have their own css with such lines as ".red {color:red}", so one cannot refer to "the red text above", etc.
* {{tag|rtc}} marks a ruby text container for ruby text components in a ruby annotation
-->
* {{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.
 
Browsers that do not support ruby characters will show the ruby text in normal size, enclosed in parentheses and after the normal content.
== Tags with special effect ==
=== Pre ===
<nowiki><pre></nowiki> tags work as the combination of <nowiki><nowiki></nowiki> and the standard HTML <nowiki><pre></nowiki> tag: the content will preformatted, and it will not be parsed, but shown as in the wikitext source. If you want preformatted but parsed text, use a space in the beginning of the line instead. For example,
 
{{markup
<nowiki><pre>This word is <b>bold</b>.</pre>
|<syntaxhighlight lang="html"><ruby>
This word is <b>bold</b>.</nowiki>
東<rtc><rp>(</rp><rt>とう</rt><rp>)</rp></rtc>
will render as
京<rtc><rp>(</rp><rt>きょう</rt><rp>)</rp></rtc>
</ruby></syntaxhighlight>
|<ruby>
東<rtc><rp>(</rp><rt>とう</rt><rp>)</rp></rtc>
京<rtc><rp>(</rp><rt>きょう</rt><rp>)</rp></rtc>
</ruby>
}}
 
Templates:
<pre>This word is <b>bold</b>.</pre>
* {{tlx|ruby}}
This word is <b>bold</b>.
* {{tlx|ruby-ja}} for Japanese
* {{tlx|Ruby-zh-p}} for Chinese pinyin
* {{tlx|Ruby-zh-b}} for Chinese bopomofo
 
==== Commentss ====
{{tag|s}} is used to indicate inline 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}}.
<b>HTML comments in the wikitext (<nowiki><!-- ... --></nowiki>) will not appear in the HTML code at all.</b>
 
{{markup
=== Headers ===
|<nowiki><s>HyperText Markup Language</s></nowiki>
Headers (<nowiki><h1>...<h6></nowiki>) will be treated in a similar way as wikicode headers:
|<s>HyperText Markup Language</s>
}}
 
Templates: {{tlx|strikethrough}} (for inline content), {{tlx|strikethroughdiv}} (for block content)
<h6>sample header</h6>
 
==== samp ====
Note that it appears in the table of contents and has an accompanying edit link. There are some minor differences though: editing such a section won't prefill the edit summary, and the browser won't jump to the beginning of the section when saving the page. Thus, you should use the wikitext equivalents instead.
{{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
|<nowiki>sample output: <samp>HTML</samp></nowiki>
|sample output: <samp>HTML</samp>
}}
 
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 ====
{{see|WP:FONTSIZE}}
{{tag|small}} format small text.
 
{{markup
|<nowiki><small>HyperText Markup Language</small></nowiki>
|<small>HyperText Markup Language</small>
}}
 
Templates:
* {{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 ====
{{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.
 
{{markup
|<nowiki><strong>HyperText Markup Language</strong></nowiki>
|<strong>HyperText Markup Language</strong>
}}
 
Templates: {{tlx|strong}}
 
==== sub ====
{{see|WP:SUBSCRIPT}}
{{tag|sub}} formats a span of text as a subscript.
 
{{markup
|<nowiki>HyperText <sub>Markup Language</sub></nowiki>
|HyperText <sub>Markup Language</sub>
}}
 
Templates:{{hlist|
| {{tlx|sub}} ({{sub|subscript}} text)
| {{tlx|subsub}} ({{subsub|subscript subscript}} text)
| {{tlx|ssub}} ({{ssub|subscript, small}} text)
| {{tlx|sup}}{{nbsp}}({{sup|superscript}} text)
| {{tlx|su}} ({{su|p=superscript|b=subscript}} text)
| {{tlx|sup sub}} (text{{sup sub|sup|sub}})
| {{tlx|e}} (1.23{{e|4}})
|style=line-height:2.5
|indent=3}}
 
==== sup ====
{{see|WP:SUPSCRIPT}}
{{tag|sup}} formats a span of text as a superscript.
 
{{markup
|<nowiki>HyperText <sup>Markup Language</sup></nowiki>
|HyperText <sup>Markup Language</sup>
}}
 
Templates:
* {{tlx|sub}} ({{sub|subscript}} text)
* {{tlx|subsub}} ({{subsub|subscript subscript}} text)
* {{tlx|ssub}} ({{ssub|subscript, small}} text)
* {{tlx|sup}} ({{sup|superscript}} text)
* {{tlx|su}} ({{su|p=superscript|b=subscript}} text)
* {{tlx|sup sub}} (text{{sup sub|sup|sub}})
* {{tlx|e}} (1.23{{e|4}})
 
==== 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.
 
{{markup
|<nowiki><time>10:00</time></nowiki>
|<time>10:00</time>
}}
 
Attributes: <code>datetime</code>
 
Support: Not supported by Internet Explorer 8 and below.
 
==== u ====
{{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|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
|<u>HyperText Markup Language</u>
|<u>HyperText Markup Language</u>
}}
 
Templates: {{tlx|underline}} (which supplies the recommended CSS style)
 
==== var ====
{{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.
 
{{markup
|1=<syntaxhighlight lang="wikitext">
*<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>
 
</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:
* {{tlx|var}}
* {{tlx|varserif}} formatted in italic serif to differentiate characters
 
==== wbr ====
{{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.
 
{{markup
|<nowiki>Now is the time to become a power editor, by learning HyperText Markup Language</nowiki>
|Now is the time to become a power editor, by learning HyperText Markup Language
 
|<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
}}
 
As the browser window is adjusted narrower, the second example wraps between ''Hyper'' and ''Text''.
 
=== Lists ===
{{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.
 
==== 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.
 
{{markup
|<syntaxhighlight lang="html"><dl>
<dt>Term</dt>
<dd>Definition 1</dd>
<dd>Definition 2</dd>
</dl></syntaxhighlight>
|<dl>
<dt>Term</dt>
<dd>Definition 1</dd>
<dd>Definition 2</dd>
</dl>
}}
 
Wikimarkup: {{tag|dt|o}} is created using <code>;</code> while automatically enclosed in {{tag|dl}}. {{tag|dd|o}} is created using <code>:</code> for each value. For a single or first value the <code>:</code> can be placed on the same line after <code>;</code> where subsequent values must be placed on separate lines.
 
{{markup
|<syntaxhighlight lang="wikitext">; Term
: Definition 1
: Definition 2</syntaxhighlight>
|<dl><!-- this wikimarkup does not render in this template -->
<dt>Term</dt>
<dd>Definition 1</dd>
<dd>Definition 2</dd>
</dl>
}}
 
Templates: {{tlx|defn}}
 
==== 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.
 
{{markup
|<syntaxhighlight lang="html"><ol>
<li>Item 1</li>
<li>Item 2</li>
</ol></syntaxhighlight>
|<ol>
<li>Item 1</li>
<li>Item 2</li>
</ol>
|<syntaxhighlight lang="html"><ul>
<li>Item 1</li>
<li>Item 2</li>
</ul></syntaxhighlight>
|<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
}}
 
Wikimarkup: use <code>*</code> for items in an unordered list and <code>#</code> for ordered lists.
{{markup
|1=<syntaxhighlight lang="wikitext"># Item 1
# Item 2</syntaxhighlight>
|2=<nowiki />
# Item 1
# Item 2
|3=<syntaxhighlight lang="wikitext">* Item 1
* Item 2</syntaxhighlight>
|4=<nowiki />
* Item 1
* Item 2
}}
 
Templates: for a variety of specialized uses, see [[:Category:List formatting and function templates]].
 
=== Containers ===
 
==== div ====
{{see|Span and div}}
{{tag|div}} is a generic container for flow content that displays as a block element.
 
{{markup
|<nowiki>HyperText <div>Markup</div> Language</nowiki>
|HyperText <div>Markup</div> Language
}}
 
==== span ====
{{see|Span and div}}
{{tag|span}} is a container for flow content that displays as an inline element.
 
{{markup
|<nowiki>HyperText <span>Markup</span> Language</nowiki>
|HyperText Markup Language
}}
 
=== Tables ===
{{see|Help:Table|MOS:TABLES}}
 
==== table, td, tr ====
{{tag|table}} defines a table.
 
* {{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.
 
{{markup
|<syntaxhighlight lang="html"><table border=1>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table></syntaxhighlight>
|2=<table border=1>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table>
}}
 
Attributes:
* {{tag|table|o}}:
*: 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" />
* {{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" />
 
==== th ====
{{tag|th}} defines a table header; styled as centered and bold.
 
{{markup
|<syntaxhighlight lang="html"><table border="1">
<tr>
<th>Header</th>
<th>Header</th>
</tr>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table></syntaxhighlight>
|2=<table border="1">
<tr>
<th>Header</th>
<th>Header</th>
</tr>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table>
}}
 
Attributes:
* {{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>height</code>, <code>nowrap</code>, <code>valign</code>, <code>width</code><ref name="w3c_obsolete" />
 
==== caption ====
{{tag|caption}} adds a caption to a table.
 
{{markup
|<syntaxhighlight lang="html"><table border=1>
<caption>Caption</caption>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table></syntaxhighlight>
|2=<table border=1>
<caption>Caption</caption>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table>
}}
 
Attributes:
* {{tag|caption|o}}:
*: Allowed but obsolete: <code>align</code><ref name="w3c_obsolete" />
 
==== 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.
 
== Obsolete/deprecated elements ==
{{main|Wikipedia:HTML5#Obsolete elements and attributes}}
These elements are now obsolete and either deprecated or removed in HTML5, although they are still supported by browsers.<ref name="w3c_obsolete" /> '''Their use should be avoided on Wikipedia.''' These tags either have an alternate tag or a template that replaces their function with CSS; except for {{tag|big}}, the tags are being replaced by editors on pages throughout Wikipedia (see [[Wikipedia:Linter]] for more details). See {{slink|Wikipedia:HTML5#Obsolete elements and attributes}} for more details on obsolete HTML parts and their replacements.
 
=== big ===
{{dc|{{tag|big}} (obsolete)}} was used to render text in a "large" font.
 
Templates: {{tlx|big}} uses CSS.
 
=== center ===
{{for|centering tables|Help:Table#Centering tables}}
{{dc|{{tag|center}} (obsolete)}} was used to center text elements.
 
Templates: {{tlx|center}} uses CSS.
 
=== font ===
{{dc|{{tag|font}} (obsolete)}} was used to set the font size, font face and color of text.
 
Templates: {{tlx|font}} uses CSS.
 
=== rb ===
{{dc|{{tag|rb}} (obsolete)}} was used to mark base text in a ruby annotation.
 
For replacements, see: [[Help:HTML in wikitext#rp, rt, rtc, ruby]]
 
=== strike ===
{{dc|{{tag|strike}} (obsolete)}} formatted strike-through characters; use {{tag|s}} or {{tag|del}} instead, depending on the context.
 
=== tt ===
{{dc|{{tag|tt}} (obsolete)}} formatted text in a fixed-width font. Use {{tag|code|o}}, {{tag|kbd|o}}, {{tag|var|o}}, or {{tag|samp|o}} instead, depending on the context.
 
Templates: {{tlx|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 ===
{{details|Help:Wiki markup#Links and URLs}}
{{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 ===
{{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.
 
== HTML Tidy ==
{{historical |type=section}}
[[HTML Tidy]] is an outdated HTML4 library{{vague|upstream is now HTML5}} 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 ==
In some pages in the [[Help:MediaWiki namespace|MediaWiki namespace]], (typically the short messages like button labels), HTML doesis not workparsed, and e.g.tags &lt;span id=abc&gt; produces the HTML &amp;lt;span id=abc&amp;gt; rendered by the browser as &lt;span id=abc&gt;. Some others are interpreted as pure HTML (thus any tag canwill be used, but wikicode won't be transformed to HTML)exposed.
 
User and sitewide [[CSS]] and [[JavaScript]] pages are interpreted as if inside a {{tag|pre|o}} block. See [[Help:User style]].
User CSS and JS pages (see [[Help:User style]]) are interpreted as if inside a <nowiki><pre></nowiki> block. From MW 1.11 this also goes for sitewide CSS/JS; in earlier versions, you have to manually add <tt><nowiki>/*<pre>*/</nowiki></tt> to the beginning and <tt><nowiki>/*</pre>*/</nowiki></tt> to the end of those pages to avoid strange rendering.
 
== Validation ==
{{mainMain|Help:Markup validation}}
The MediaWiki software attempts to catchfix HTML errors, but it does not catch all of them. If you useWhere HTML inis wikitextused, it is helpful to verify it with the [[W3C Markup Validation Service]].
 
== Parser and extension tags ==
{{shortcut|Help:Extension tag|Help:Parser tag}}
{{#section:Template:Xtag/doc|xtag}}
 
== See also ==
* [[Help:Wikitext]]
* [[Wikipedia:HTML5]]
* [[:Category:Wikipedia XHTML tag-replacing templates]]
 
== References ==
{{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="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>
}}
 
== 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 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]
* For customizing the handling of HTML in MediaWiki, see the HTML and Tidy sections in [[mw:Manual:Configuration settings]]
* Some extensions allow adding arbitrary HTML to a page, for example [[mw:Extension:AddHTML]], [[mw:Extension:SecureHTML]] and [[mw:Extension:Secure HTML]]; see [[mw:Manual:$wgRawHtml|$wgRawHtml]] for a more complete list
* Within the MediaWiki codebase, these HTML checks happen in [http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/Sanitizer.php includes/Sanitizer.php]
 
{{Wikipedia directories}}
==See also==
*[[{{Wikipedia:Span tags]]editor navigation}}
 
[[Category:Editor handbook]]
[[Category:Wikipedia editor help]]
 
[[pt:Ajuda:HTML]]