Help:Useful styles

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

This page documents various CSS elements that are useful to know when working in the article and template namespaces. For information about how to use them, see:

Classes

  • wikitable This class represents Wikipedia's favored style for data tables.
  • toccolours This class gives the template borders and colors similar to that of the Table of Contents of a page. Do not use id="toc" instead of this, as it risks breaking some scripts and causing other problems (every id= value on a page must be unique). toccolours is not used much anymore, but used to be used for footer templates etc.
  • navbox This class is used on most footer templates (e.g. {{Regions of the world}}). See also Template:Navbox.
  • infobox This class is used for infoboxes (e.g. {{Infobox Settlement}}).
  • *mbox-*: Message boxes to be used on…
    • ambox-*: articles;
    • tmbox-*: talk pages;
    • cmbox-*: categories;
    • imbox-*: images and
    • ombox-*: pages in other namespaces (notably Wikipedia:).
    • mbox-* (image, text, imageright, small): To be used along with the above, in any namespace

Specific styles

  • border-collapse:collapse This style will eliminate 3-d style borders created by the border attribute and collapse them in 1px wide borders. This property will override cellspacing! To define similar whitespace, use the border-spacing property (although it is not possible to have both border-spacing and border-collapse for the same table).

Moving stuff

  • float:right and clear:right These styles are used to move a table to the right-hand side of the screen. Float right is equivalent to align="right" The clear code property makes it impossible for the movement to be blocked by another box or picture: the template will automatically move under it.

Margins and sizes

  • margin:0 0 0.5em 1em; This style prevents text from running straight to the template by saving blank space. It should be used on boxes which are floated right (using float: right;).
    • margin:0 1em 0.5em 0; This performs the same function as the style directly above, but should be used for boxes which are floated left (using float: left;).

See also

Retrieved from "https://en.wikipedia.org/w/index.php?title=Help:Useful_styles&oldid=818760177"
This content was retrieved from Wikipedia : http://en.wikipedia.org/wiki/Help:Useful_styles
This page is based on the copyrighted Wikipedia article "Help:Useful styles"; it is used under the Creative Commons Attribution-ShareAlike 3.0 Unported License (CC-BY-SA). You may redistribute it, verbatim or modified, providing that you comply with the terms of the CC-BY-SA