Wikipedia:WikiProject Usability/HTML
{{cleanup|date=November 2010}}
{{Wikipedia:WikiProject Usability/Navigation menu | Miscellaneous}}
Wiki supports a subset of XHTML, e.g. <br /> instead of <br>.
Wikipedia allows the use of HTML directly, and the use of CSS through the style="[…]"
and class="[…]"
attributes.
We believe that:
- The use of HTML instead of Wiki markup is discouraged
- If HTML and CSS must be used, editors should know how to use them properly, with regard to:
- W3C standards
- Cross-browser compatibility
Why HTML should be used conservatively
HTML makes the edit pages hard to read for many users, and on a wiki the readability of the edit page is almost as important as the readability of the page itself, because nobody wants to edit something that they don't understand.
Occasionally, such as when you are creating notices, and so on (for which there is no markup defined) HTML/CSS must be used.
HTML and CSS primer
HTML is simple to use - just put a pair of tags around some text, e.g. Sometimes, however, there isn't any appropriate wikicode for what you want to mark up. In this situation, there are two possible contexts, block and inline. Paragraphs, headings, lists and tables are block elements (they start on a new line), These span and div tags need : produces : Where possible, an appropriate class should be used instead of inline styles, to avoid clutter in the edit window and to be able to change the appearance of, for example, all article message boxes at once. However, when you must use inline styles, you can do this. They take the following form: Before listing properties, you should get to know how to represent certain values: Please note: this page does not want to encourage the use of bright, or non-standard colors. They are used for clearer examples. Please see Wikipedia:WikiProject Usability/Color {{Main|Wikipedia:Catalogue of CSS classes}}
, and it will show up as the tags defined it. Most HTML elements, like
(bold),
(italics),
,
and
(lists),
,
, … (headings) and even (tables) have their equivalent in wikicode, so should be avoided in the main space. The CSS, which provides presentational hints for user agents (like browsers), may be added to the markup itself – this is covered later.
&
are inline elements. In each context, there is a generic HTML element available:
: inlineclass
or style
attributes to change the appearance of the page.style="p: v; p: v; …"
, where p is a property and v the value you want to assign to that property.= List of style properties =
== Basic properties ==
color: color;
– the foreground color.
→ testbackground: color;
– 'shorthand' for several background properties, notably the background color.
→ testborder: thickness type color;
– the border: color, type and thickness. Type may be solid, inset, outset, dashed, and others.
→ test
→ test
→ footestbarpadding: thickness;
– the "spacing" on the inside of the border. 1, 2, 3 or 4 sizes may be specified, for the four sides of the element.
→ footestbar
→ footestbar
→ footestbar
→ footestbarmargin: thickness;
– the "spacing" on the outside of the border. It's also the distance at which other elements should be "kept away" at. 1, 2, 3 or 4 sizes may be specified, exactly as in "padding". Many user agents will ignore top
and bottom
for margins on inline elements.
→ footestbar
→ footestbar
→ footestbar
→ footestbar
→ footestbar= List of classes =
class="class1 class2 …"
noprint
and metadata
– will not get printed onto paper. metadata
is more descriptive for actual metadata, like notices, but the intent of noprint is much clearer.
→ See also