== 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>.
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>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 [[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.
HTML5 microdata attributes apply to all tags:{{r|html5microdata}}
* 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
[[RDFa]] attributes:{{r|rdfa}}
* <code>about</code>
* <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
|<nowiki>This is <span style="color:red;">red</span> text.</nowiki>
|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.
* 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 element]]s are supported by the MediaWiki software. This section gives a brief overview of the HTML element, an example, relevant wikimarkup and templates.
|