Permitted HTMLThe following HTML elements are currently permitted:
is treated like the wikitext
and is therefore displayed as
which is unlikely to be what the editor intended. Instead of using the anchor element (<a>) the wiki markup for external reference is recommended (enclosed in square brackets with the URL separated from the contents by a single space):
displays as:
The following excerpt from Sanitizer.php additionally shows which attributes are allowed. $htmlpairs = 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' ); $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 'td', 'th', 'tr' ); Tags
For example a <font color="red">red</font> word. produces the same result as a <span style="color:red">red</span> word. See also m:Template:font size demo (backlinks, edit) and m:Help:Text color. It's pointless to combine the legacy tag <font> with inline CSS; legacy browsers would ignore the CSS, while modern browsers support <span> (see above). Note that in most cases, one can use a more descriptive tag, for instance, <strong> to indicate an important piece of text, or <em> (subject to the same things as strong) to indicate an emphasized piece of text. 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 emphasized text. Using <span> as a link targetThe standard way of providing a named anchor as an invisible target (i.e. However, <div>
Example: HTML commentUsing m:Template:t (backlinks, edit):
The "Remove comments" option of 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. Example: Wikitext:
{{#expr:<!--p-->3}}
{{#ifeq:<!--p-->3|3|1|0}}
{{#if:<!--p-->|1|0}}
Result of normal expansion, and of ExpandTemplates with "Remove comments" on: 3 1 0 Result of full substitution, and of ExpandTemplates with "Remove comments" off: Expression error: Unrecognised punctuation character "" 0 1 Therefore it is typically better to avoid comments in these places, and to put the comment before or after the parser function. In the case of nested parser functions, to avoid having to put the comments outside the whole, an alternative is {{void|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 {{{{{subst1|}}}#expr:3*{{{1}}} {{{{{subst1|}}}void| multiply by 3 }}}}. 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. {{{ 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 -->|}}}. See also m:Template:t comment (backlinks, edit). AttributesMost tags can have a style attribute. For example <div style="font-size:80%"> This is <span style="color:red">red</span> text. </div> produces:
<div class="infobox">Example infobox</div> Example infobox
Produces the box which floats on the right because infobox class is already defined in local Mediawiki:Common.css. Classes and IDs can also be used by Javascript code, for example see how {Link FA} works in enwiki.
Tags with special effectPre<pre> tags work as the combination of <nowiki> and the standard HTML <pre> 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, <pre>This word is <b>bold</b>.</pre> This word is <b>bold</b>. will render as This word is <b>bold</b>. This word is bold. CommentsHTML comments in the wikitext (<!-- ... -->) will not appear in the HTML code at all. HeadersHeaders (<h1>...<h6>) will be treated in a similar way as wikicode headers: sample headerNote 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. ExceptionsIn some pages in the MediaWiki namespace (typically the short messages like button labels) HTML does not work, and e.g. <span id=abc> produces the HTML <span id=abc> rendered by the browser as <span id=abc>. Some others are interpreted as pure HTML (thus any tag can be used, but wikicode won't be transformed to HTML). User CSS and JS pages (see Help:User style) are interpreted as if inside a <pre> block. From MW 1.11 this also goes for sitewide CSS/JS; in earlier versions, you have to manually add /*<pre>*/ to the beginning and /*</pre>*/ to the end of those pages to avoid strange rendering. External links
Wikipedia-specific helpIt is much preferred to use wikimarkup when there is a HTML equivalent. This page is a copy of the master help page at Meta (for general help information all Wikimedia projects can use), with two Wikipedia-specific templates inserted. To update the main text, edit the master help page for all projects at m:Help:HTML in wikitext. For Wikipedia-specific issues, use Template:Ph:HTML in wikitext (the extra text at the bottom of this page) or Template:Phh:HTML in wikitext for a Wikipedia-specific lead (text appears at the top of this page). You are welcome to replace the full wikitext of this page with that of the master page at Meta at any time. To view this page in other languages see the master page at Meta. This is an extract from Wikipedia, the Free Encyclopediaofferte voli | hoteles | precios | voli | die verzeichnis | annuarie web | stop smoking london | ||||||||