Wikipedia:HTML5

The development of HTML5 is now so far advanced that it was incorporated into the MediaWiki software and has been the default on Wikimedia wikis since September 2012.

This project serves to help editors organize the adaptation of articles and other Wikipedia pages to HTML5. The fifty or so prepared searches reveal the obsolete tags. The edits range from simple to complex, and the numbers from a few fixes anyone can enjoy updating manually, up to many thousands for a run with a Wikipedia:AutoWikiBrowser bot script.

Scope

Implementation of the new HTML5 attributes accepted by MediaWiki software. These include:

  • The following attributes relevant for Wikipedia tables are also considered obsolete in HTML5: bgcolor, border, bordercolor, cellpadding, cellspacing.
  • The following elements were formerly obsolete in HTML4 and "rehabilitated" in HTML5: u and s

Obsolete elements and attributes

These elements and attributes should no longer be used on Wikipedia pages. See each element or attribute's details for its recommended replacement.

center

Text

For most text, <center>...</center> can be replaced with {{center}}.

Templates

To center templates, check the template documentation as most have a parameter for general styling or specifically for alignment. If the template does not have an alignment parameter, consider adding one.

Searches for templates do not find redirects, but you can alter the query to complete the search for that template's obsolete usage: for each template list its redirects with the "What Links Here" tool, and replace the two occurrences of its template name. Do this for each of its redirects in turn.

Parser tags

Some parser tags can use CSS styles:

Tables

To center a table, use CSS styling:

And likewise to center a cell:

Header cells are centered by default.

Files

font

The <font> element has three attributes with equivalent CSS properties:

Note that for color names, only the W3C specified basic and extended colors are valid with CSS. <font> accepts arbitrary strings for color names; CSS does not support these. When converting to CSS, these strings can be replaced either with a sufficiently similar hexadecimal color code or a valid color name that is nearest to their shade. For example:

Hexadecimal color codes without the # prefix are valid with <font>, but # is mandatory with CSS. Only 3 and 6 digit hex codes are valid in CSS. When 4 and 5 digit codes have to be converted to CSS, they need to be appended with 00 and 0 respectively. For 8 digit hex codes, the last two digits have to be discarded.

Note that in HTML the value for the size attribute does not correspond to any CSS value; it only accepts values 1 through 7.

The above searches will find all permutations of the three color attributes. For example:

strike

<strike>...</strike> formats strike-through characters. (search articles) (search all)

  • Use <s>...</s> for text that is no longer correct, accurate, or relevant.
  • Use <del>...</del> for text that has been deleted or marked for deletion.

tt

<tt>...</tt> formats text in a fixed-width font. (search articles) (search all)

  • Use {{code}} or <code> for source code.
  • Use {{kbd}} or <kbd> for computer input (it need not represent actual keystrokes)
  • Use {{samp}} or <samp> for sample output from a program or system (can include directory listings and other matter)
  • Use {{var}} or <var> for variable names (in code, mathematics, or even syntactic variables in regular writing).
  • Use {{mono}} for monospace-styled text without the semantics of any of the above.

Table attributes

Obsolete table attributes.

Allowed, obsolete but rarely used table attributes:

Additionally, these attributes are obsolete on table cells.

  • abbr: Elaborate content of the cell
  • scope on table cell: scopeis valid only on table header

There are instances where a table is used to align a template. In many cases the template has an alignment parameter; if not, one should be added.

MarkupValid
{|align=right
|{{navbar|Foo}}
|}

{{navbar|Foo|style=float:right}}

Other obsolete attributes

  • clear on <br />
  • align on <div>

Obsolete, allowed but rarely used attributes:

Misused elements

cite

Under the previous HTML 4.01 and XHTML 1.1 usage <cite>...</cite> defined an entire citation. With HTML5, a long-running dispute has erupted:

  • The W3C specs preserve the broad usage, though now require that the material contain at least one of: the title of the cited work, its author, a URL to the work, or an abbreviated reference (short citation, as used in Harvard referencing). This is the spec followed by most Web developers.
  • The WHATWG specs have limited the element to the title of the work only. This is the spec followed by most browser developers. The only practical implications of WHATWG's break from W3C on this element is that the default browser treatment of the element (to italicize its content) would be applied to more material than the title. However, Wikipedia's site-wide CSS turns off this stylization anyway (per MOS:TITLES, only titles of particular kinds of works should be italicized).

W3C briefly switched to WHATWG's definition in the draft stages of HTML5, but switched back to their own definition in 2012 after protest from the Web developer community. This difference subsequently disappeared when the W3C's version was subsumed into the WHATWG's version in the late 2010s and now the WHATWG's version is the only version in relation to the cite element.

Following common practice (e.g. the use of <cite> around links to author IDs in blog and forum software, and many other well-deployed uses for the element for more than work titles), Wikipedia is following the W3C HTML5.2 Recommendation, which has superseded HTML 4.01, XHTML 1.1, and all other previous W3C [X]HTML specs. Our citation template system wraps the entire citation in the <cite>...</cite> element.

Note that uses of <cite> exist without the closing </cite>, or incorrectly closed by </span>; these need to be repaired.

Where used with a Citation Style 1 or Citation Style 2 template, a manually-added <cite> should be removed as redundant markup:

Where an anchor id is manually used with a citation template, the id should be moved to the |ref= parameter. Additionally when removing cite tags with id=CITEREF please understand that this was a manual reference, and must be updated by removal, then making sure that the all the numbered |last= parameters such as |last1= are available, which in turn may require changing any (deprecated) numbered |authorx= parameter used into a |lastx= parameter and a matching |firstx= one. See the example with and without the id=CITEREF... and |author3=, below.

Tools

The following tools may be useful when checking Wikipedia:

The following scripts may also be helpful when checking Wikipedia:

The following user CSS may be of further help in identifying material to clean up while editing normally:

  • lint.css (language-independent; English instructions)

See also: Wikipedia:Linter § Reports

Bots

Bots based upon AWB or Pywikibot can correct many of the problems.

Here are the bots actively working on English Wikipedia. They can be ported to other languages.

NameActive?Errors fixed
(by CW task number)
BG19bot (task list · contribs)Nomany
Dexbot (task list · contribs)Yes7, 19, 25, 83
FrescoBot (task list · contribs)Yes16, 48, 64
Josvebot (task list · contribs)Yes6, 16, 37
MenoBot (task list · contribs)Yesmany
PkbwcgsBot (task list · contribs)No2, 3, 7, 16, 17, 25, 32, 85, 86, 88, 90, 91, 524
WikiCleanerBot (task list · contribs)Yes1, 2, 7, 16, 17, 25, 46, 48, 61, 64, 83, 85, 88, 90, 91, 92, 106, 513, 532, 534, 539, 540, 543, 547, 548, 549, 550, 551, 553, 555, 557, 558, 565, 567
Xqbot (task list · contribs)Yes3
Yobot (task list · contribs)Nomany
BunnysBot (task list · contribs)Yesmany

Bots fix some of the errors here automatically. Any error tagged with "BOT" is usually fixed by a bot at some point, so manually fixing them is unnecessary.

Collection of further ideas

Participants

See also

References

Uses material from the Wikipedia article Wikipedia:HTML5, released under the CC BY-SA 4.0 license.