Help:HTML in wikitext: Difference between revisions
Content deleted Content added
Caleb Cooper (talk | contribs) |
Caleb Cooper (talk | contribs) |
||
| (21 intermediate revisions by the same user not shown) | |||
Line 6:
{{Commons Import}}
The MediaWiki software, which drives Wikipedia, allows the use of a subset of [[Wikipedia:HTML 5]] [[Wikipedia:HTML element|elements]], or tags and their [[Wikipedia:HTML attribute|attributes]], for presentation formatting.{{r|sanitizer}} But most HTML can be included by using equivalent [[Wikipedia:Help:Wiki markup|wiki markup]] or [[Wikipedia: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 [[Wikipedia: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:HTML 5|deprecated by HTML 5]], and therefore should no longer be used.
Line 23:
* <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>lang</code>: primary language for the contents of the element per [[Wikipedia:BCP 47|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>style</code>: applies CSS styling to the contents of the element.
* <code>title</code>: advisory information associated with the element.
Line 65:
==== h1, h2, h3, h4, h5, h6 ====
{{see|Wikipedia:Help:Section|Wikipedia: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 [[Wikipedia:Help:Cascading Style Sheets#Wiki headings|styled through CSS]] and added to the page's [[Wikipedia:Help:table of contents|table of contents]].
{{markup
Line 134:
==== br ====
{{see|Wikipedia:Help:Line-break handling#<br />|Wikipedia:Don't use line breaks}}
{{tag|br|o}} or {{tag|br|s}} inserts a line break. Both versions of the break are supported by HTML5. Using {{tag|br|o}} without the <code>/</code> breaks [[Wikipedia:Syntax highlighting#Syntax highlighting of wiki-code for editors|syntax highlighting]], so should be avoided. {{tag|br|c}} is invalid.
Line 265:
==== code ====
{{tag|code}} formats a section of computer code. Styled with [[Wikipedia:Cascading Style Sheets|CSS]] through {{elements.css}} as a monospaced slab serif typeface with border.
{{markup
Line 376:
===== HTML entities =====
{{tag|pre|o}} parses [[Wikipedia:Character encodings in HTML|HTML entities]]. If you want to escape this, replace <code>&</code> with <code>&amp;</code>, or use {{xtag|source|params = lang="text"}} instead.
{{markup
Line 418:
[[Wikipedia:MOS:QUOTATIONS]] says Wikipedia should instead use "", {{tl|quote}}, or <nowiki><blockquote></nowiki>.
==== s ====
Line 571 ⟶ 542:
==== wbr ====
{{see|Wikipedia:Help:Line-break handling#<wbr /> 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.
Line 661 ⟶ 632:
==== div ====
{{see|Wikipedia:Span and div}}
{{tag|div}} is a generic container for flow content that displays as a block element.
Line 670 ⟶ 641:
==== span ====
{{see|Wikipedia:Span and div}}
{{tag|span}} is a container for flow content that displays as an inline element.
Line 801 ⟶ 772:
=== 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 [[Wikipedia:interwiki links|interwiki links]], and <code><nowiki>[ ]</nowiki></code> for external links.
=== input ===
{{details|
{{tag|input|o}} is used to create [[Wikipedia:Form (HTML)|forms]]. The {{xtag|inputbox}} extension tag is used to create a text box with a button.
== HTML Tidy ==
[[Wikipedia: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 [[Wikipedia:Help:MediaWiki namespace|MediaWiki interface pages]]. Tidy was never perfect and has been known to introduce errors.
== Exceptions ==
In some pages in the [[Wikipedia:Help:MediaWiki namespace|MediaWiki namespace]], typically the short messages like button labels, HTML is not parsed, and tags will be exposed.
User and sitewide [[Wikipedia:CSS]] and [[Wikipedia:JavaScript]] pages are interpreted as if inside a {{tag|pre|o}} block. See [[Wikipedia:Help:User style|Help:User style]].
== Validation ==
{{Main|Wikipedia: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 [[Wikipedia:W3C Markup Validation Service|W3C Markup Validation Service]].
== Parser and extension tags ==
{{#section:Template:Xtag/doc|xtag}}
Line 837 ⟶ 807:
* 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: [//www.w3.org/TR/html5/fullindex.html#index-elements elements] | [//www.w3.org/TR/html5/fullindex.html#attributes-table attributes]
[[Category:Wikipedia editor help]]
| |||