On Wikipedia, HTML <span>...</span>
elements are used to group logically related text. They allow:
- Explicitly setting the CSS style for an inline run of text
- Explicitly setting the language for a run of text (for cases where the rendering differs from language to language; this is generally done through the
{{Lang}}
templates, not with manual span markup) - Explicitly setting the direction of the text (LTR or RTL).
- Avoidance of other HTML tags, such as
<s>
and the now-deprecated<strike>
, which would otherwise be used as workarounds, but are less suitable. - Syntax highlighting; code excerpts can be colorized for easier reading, customizable with CSS.
- Various uses in infoboxes and navigational templates.
- Specification of class and id attributes for certain boilerplate messages which should be inlined; e.g., {{merge}}.
- Citation templates (see above).
- Setting anchors in the text to which incoming links may jump; this is usually done with the
{{Anchor}}
template.
Almost all HTML tags that are allowed in Wikipedia permit inline CSS styles.
History
[edit]Span tags were enabled in MediaWiki on December 23, 2004. Polls were held in May and August 2004 on whether the English Wikipedia should enable them. The results were equally split between supporting and opposing the addition of these tags. In December, the earlier objections that this would be a semantically void element were deemed to be no longer applicable since MediaWiki now has a way to add to the global stylesheets in the wiki (at least for the main skins). The addition of <span>
to the whitelist was announced, following no general objection amongst developers.
Get personal technical help at the Teahouse, help desk, village pump (technical), talk pages or IRC. | |
General technical help | |
Special page-related | |
Wikitext | |
Links and diffs | |
Media files: images, videos and sounds | |
Other graphics | |
Templates and Lua modules | |
Data structure | |
HTML and CSS | |
Customisation and tools | |
Automated editing | |
|