For a list of classes that can be used with the span tag, see WP:Catalogue of CSS classes.

In Wikipedia, Span tags 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, through {{Lang}})
  • Explicitly setting the direction of the text (LTR or RTL).
  • Avoidance of other HTML tags, such as <s> and <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).

Almost all HTML tags that are allowed in Wikipedia permit inline CSS styles.

History

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 <span> tags. 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.