Help:HTML in wikitext: Difference between revisions

Content deleted Content added
strike: update
Obsolete/deprecated elements: big is not obsolete in Linter
 
(16 intermediate revisions by 6 users not shown)
Line 1:
{{Short description|Usage of HTML tags with MediaWiki}}
<noinclude>{{pp-semi-indef|small=yes}}</noinclude>
 
{{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}}
{{Locutions pages header}}
{{Wikipedia how to|H:HTML|WP:HTML}}
 
{{Wiki markup}}
{{HTML}}
 
The [[MediaWiki]] software, which drives Wikipedia, allows the use of a subset of [[HTML 5HTML5]] [[HTML element|elements]], or tags and their [[HTML attribute|attributes]], for presentation formatting.{{r|sanitizer}} ButHowever, most HTML functionality can be included byreplicated using equivalent [[Help:Wiki markup|wiki markup]] or [[Help:TemplateTemplates|templates]];. theseThese alternatives are generally preferred within articles, asbecause they are sometimesoften simpler for most editors to use and less intrusive in the editing window; butinterface. [[Wikipedia:Manual_of_Style#Keep_markup_simple|Wikipedia's Manual of Style]] recommends theirwhen useand inwhere certainthese alternatives should be casesused. (See [[Help:Wikitext]] for wikiwikitext 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]].
 
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 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.
 
Some tags lookthat likeresemble HTML, but are actually MediaWiki [[#Parser and extension tags|parser and extension tags]], and so are reallyactually wiki markup. HTML included in pages can be checkedvalidated for HTML5 compliance by using [[#Validation|validation]]. SomeNote that 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}}
{{TOC limit|3}}
 
== Tutorials ==
Line 171 ⟶ 170:
 
==== Comments ====
{{see|WPMOS:COMMENT}}
{{tag|!--}} formats the enclosed text as a hidden comment.
 
Line 426 ⟶ 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 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 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 461:
}}
 
Templates: {{tlx|strikethrough}} (for inline content), {{tlx|strikethroughdiv}} (for block content)
 
==== samp ====
Line 778:
== Obsolete/deprecated elements ==
{{main|Wikipedia:HTML5#Obsolete elements and attributes}}
These elements are now obsolete and either deprecated or removed in HTML5, and although they are still supported by browsers,.<ref name="w3c_obsolete" /> their'''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 ===
Line 794 ⟶ 799:
{{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|o}} or {{tag|s|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.
Line 817 ⟶ 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 ==