Wikipedia:HTML_5

Wikipedia:HTML5

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:

More information obsolete in HTML5, Replacements ...
  • 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[5]

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}}.

More information Obsolete, Replacement ...

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.

More information Obsolete, Replacement ...

Parser tags

Some parser tags can use CSS styles:

More information Obsolete, Replacement ...
These parser tags will accept class="center" <categorytree> (search articles) (search all)
<gallery> (search articles) (search all)
<poem> (centers all lines) (search articles) (search all)
<pre> (search articles) (search all)
<syntaxhighlight> (search articles) (search all)
<source> (search articles) (search all)
These parser tags do not handle CSS; use {{center}} <hiero> (search articles) (search all)
<math> (search articles) (search all)
<score> (search articles) (search all)
<timeline> (search articles) (search all)
<ref> (search articles) (search all)
These parser tags use other means <imagemap> uses a center parameter; see the documentation (search articles) (search all)
These parser tags default to center alignment <inputbox> (search articles) (search all)
These parser tags do not handle CSS and do not need alignment

Tables

To center a table, use CSS styling:

More information Obsolete, Replacement ...

And likewise to center a cell:

More information Obsolete, Replacement ...

Header cells are centered by default.

Files

More information Obsolete, Replacement ...

font

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

More information Font attribute, CSS ...
More information Obsolete, Replacement ...

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:

More information Obsolete, Replacement ...

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.

More information Obsolete, Replacement ...
More information Obsolete, Replacement ...

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

More information Obsolete, Replacement ...

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

More information Obsolete, Replacement ...

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.[7][8]

More information Obsolete attribute, CSS style on cell style="CODE BELOW" ...

Allowed, obsolete but rarely used table attributes:

Additionally, these attributes are obsolete on table cells.[9][10]

  • 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.

More information Markup, Valid ...

Other obsolete attributes

  • clear on <br />
More information Obsolete, Replacement ...
  • align on <div>
More information Obsolete, Replacement ...

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:

More information Obsolete, Replacement ...

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.

More information Obsolete, Replacement ...

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.

More information Name, Active? ...

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

Collection of further ideas

Participants

See also


References

  1. "15.2 Non-conforming features". HTML Living Standard.
  2. SELFHTML – HTML/deprecated
  3. W3C (2018-03-10). "CSS Fonts Module Level 3". Retrieved 2018-06-23.{{cite web}}: CS1 maint: numeric names: authors list (link)

Share this article:

This article uses material from the Wikipedia article Wikipedia:HTML_5, and is written by contributors. Text is available under a CC BY-SA 4.0 International License; additional terms may apply. Images, videos and audio are available under their respective licenses.