Jump to content

Help:Markup validation

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 2607:fb90:4432:7846:0:44:9110:6301 (talk) at 02:45, 22 March 2020. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Common diagnostics and how to fix them

This section gives examples of diagnostics generated by the markup validation service, and suggests possible fixes. Diagnostics are by line and column of the generated HTML for the page. It may be helpful to obtain the HTML in order to understand the diagnostic. For example, if you using the Firefox browser, you can type control-U to see the HTML.

ID already defined

Line 630, Column 88: ID "CITEREFBarker2008" already defined
...</a></b> <span class="citation" id="CITEREFBarker2008">Barker, Janice (2008-0
An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).

This error occurs if an article contains multiple invocations of the {{citation}} template with the same author and year; the above error was prompted by an article that cited two different documents, both written by Barker in 2008. Disambiguate the citations by putting letters after the years (e.g., |year=2008a, |year=2008b), or by using the ref= parameter of {{citation}}.

HTML ids are only needed when using Shortened footnotes or Parenthetical referencing. The {{citation}} template always generates an HTML id; with Citation Style 1, this is optional and Citation Style Vancouver never creates ids.

Line 93, Column 231: ID "ref_1" already defined
...ence plainlinks nourlexpansion" id="ref_1"><a href="#endnote_1">1</a></sup><...
An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element).

This similar diagnostic occurs if an article contains multiple invocations of {{ref}} with the same ID, for example, two instances of "{{ref|1|1}}". To fix the problem, use different IDs. Templates using the ref_ id prefix include {{ref}}, {{ref label}}, {{cref}} and {{cref2}}.

Missing alt text

Line 135, Column 108: required attribute "alt" not specified
...,107" title="Hurricane Ida (2009)" />
The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element....

This diagnostic can result from use of the EasyTimeline extension, which does not support accessibility and does not generate alternative text for visually impaired readers. Such a problem can be fixed by redoing the timeline as text, as an image, or as an image map.

Element dl is missing a required instance of child element dd

Error Line 78, Column 5: Element dl is missing a required instance of child element dd.
</dl>
Content model for element dl:
Zero or more groups each consisting of one or more dt elements followed by one or more dd elements.

Definition lists are created with the wikimarkup ; to define a definition list and : to define the item in the list. This diagnostic results when the : is missing.

  • Indentation is created using the : markup. This creates a definition list with no child element. T6521
  • This also occurs when ; is misused to bold a line. Use the wikimarkup ''' to bold characters.

CSS validation

The W3C also has a CSS validator, but this is less of an issue when editing Wikipedia pages, as CSS is an option and CSS validation errors typically are due to problems with skins, not problems in individual pages.

See also