Content deleted Content added
→br: please do *not* encourage invalid forms |
→Obsolete/deprecated elements: big is not obsolete in Linter |
||
(36 intermediate revisions by 13 users not shown) | |||
Line 1:
{{Short description|Usage of HTML tags with MediaWiki}}
<noinclude>{{pp-semi-indef|small=yes}}</noinclude>
{{Wikipedia how to|H:HTML|WP:HTML}}
{{Wiki markup}}
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]].▼
▲The [[MediaWiki]] software, which drives Wikipedia, allows the use of a subset of [[
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:HTML 5|deprecated by HTML 5]], and therefore should no longer be used.▼
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]].
▲Some tags
== Tutorials ==
This help page gives only an overview of allowed markup. For further assistance and detailed specifications:
* [https://developer.mozilla.org/en-US/docs/
* [https://www.w3schools.com/html/default.asp HTML5 Introduction] at w3schools.com
Line 167 ⟶ 170:
==== Comments ====
{{see|
{{tag|!--}} formats the enclosed text as a hidden comment.
Line 265 ⟶ 268:
==== 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>
|use <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;
}}
Line 339 ⟶ 344:
==== 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
Line 367 ⟶ 372:
{{markup
|<nowiki><pre>HyperText Markup Language</pre></nowiki>
|col2=Renders as<ref name="white bgcolor"/>
|col2style=background-color:#fff
|<pre>
Line 380 ⟶ 386:
{{markup
|<nowiki><pre>&amp;</pre></nowiki>
|col2=Renders as<ref name="white bgcolor"/>
|col2style=background-color:#fff
|<pre>
Line 418 ⟶ 425:
[[MOS:QUOTATIONS]] says Wikipedia should instead use "", {{tl|quote}}, or <nowiki><blockquote></nowiki>.
==== rp, rt, rtc, ruby ====
{{see|Ruby character}}
{{tag|ruby}} marks spans of phrasing content with ruby annotations.
* {{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.
Line 430 ⟶ 438:
{{markup
|<syntaxhighlight lang="html"><ruby>
東<rtc><rp>(</rp><rt>とう</rt><rp>)</rp></rtc>
京<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>
}}
Line 446 ⟶ 454:
==== s ====
{{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}}.
{{markup
Line 453 ⟶ 461:
}}
Templates: {{tlx|strikethrough}} (for inline content), {{tlx|strikethroughdiv}} (for block content)
==== samp ====
Line 459 ⟶ 467:
{{markup
|<nowiki>sample output: <samp>
|sample output: <samp>
}}
Line 555 ⟶ 563:
{{markup
|1=<syntaxhighlight lang="wikitext">
*
*<
*
</syntaxhighlight>
|2=
*<var>E</var>=<var>m</var>c<sup>2</sup> (c is a constant not a variable)<br />
Line 607 ⟶ 618:
{{markup
|<
: Definition 1
: Definition 2</
|<dl><!-- this wikimarkup does not render in this template -->
<dt>Term</dt>
Line 643 ⟶ 654:
Wikimarkup: use <code>*</code> for items in an unordered list and <code>#</code> for ordered lists.
{{markup
|1=<syntaxhighlight lang="
# Item 2</syntaxhighlight>
|2=<nowiki />
# Item 1
# Item 2
|3=<syntaxhighlight lang="
* Item 2</syntaxhighlight>
|4=<nowiki />
Line 767 ⟶ 778:
== Obsolete/deprecated elements ==
{{main|Wikipedia:HTML5#Obsolete elements and attributes}}
These elements are now obsolete and either deprecated or removed in HTML5,
=== 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)}}
Templates: {{tlx|center}} uses CSS.
=== font ===
{{dc|{{tag|font}} (obsolete)}}
Templates: {{tlx|font}} uses CSS.
=== rb ===
{{dc|{{tag|rb}} (obsolete)}}
For replacements, see: [[Help:HTML in wikitext#rp, rt, rtc, ruby]]
=== strike ===
{{dc|{{tag|strike}} (obsolete)}}
=== tt ===
{{dc|{{tag|tt}} (obsolete)}}
Templates: {{tlx|mono}} uses CSS.
Line 806 ⟶ 822:
== 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 ==
Line 822 ⟶ 839:
== See also ==
* [[Help:
* [[Wikipedia:HTML5]]
* [[:Category:Wikipedia XHTML tag-replacing templates]]
== References ==
Line 834 ⟶ 852:
== 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]
{{Wikipedia directories}}
|