Difference between revisions of "Template:TOCright"

From Action
Jump to navigation Jump to search
m (1 revision)
m (Rollback to fix Wikipedia template import overwrite.)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
#REDIRECT [[Template:TOC right]]
+
{| cellspacing="0" cellpadding="0" style="clear: {{{clear|right}}}; margin-bottom: .5em; float: right; padding: .5em 0 .8em 1.4em; background: none; width: {{{width|{{{1|auto}}}}}};" {{#if:{{{limit|}}}|class="toclimit-{{{limit}}}"}}
 +
| __TOC__
 +
|}<noinclude>
 +
{{{{FULLPAGENAME}}/doc}}
 +
<!-- Add cats and interwikis to the /doc subpage, not here! -->
 +
</noinclude>

Latest revision as of 14:30, 11 June 2009

The template documentation below is transcluded from Template:TOCright/doc [edit]
  1. {{TOCright}} forces the auto-generated Table of Contents for an article to appear in a table that is floated to the right side of the page (as seen right), in order to improve article layout.
  2. {{TOCnestright}} Operates similarly, but is designed to use early in introduction or second sections on the many pages having a lot of images or wikitable elements such as infoboxes dominating the right side of such pages. TOCnestright will drift up against such constructs allowing text wrapping above, left and below preventing discordantly ugly page breaks and large excessive whitespace gaps on the page as given by the default TOC.

Usage

Insert {{TOCright}} at the point in the article where you want the top of the Table of Contents box to appear. Use with {{-}} or {{clear}} to prevent coalition with text or use {{clearleft}} or {{clearright}} to prevent images coalitions.

Parameters (optional)

clear
Sets the CSS clear property, which forces this float underneath the side specified with this attribute. So, clear=right (which is the default) will place the element after all the right floating elements before it. Options are left, right, both, or none.
width
Set the CSS width.
limit
Limits the depth of subheadings shown. For instance using limit=4 will hide the fourth level and deeper subheadings in the hierarchy. And limit=2 will hide all subheadings leaving only the main headings. This is implemented as a CSS class in the MediaWiki:Common.css.

Cautions

Usage of this template remains controversial with many editors and readers as it breaks consistency with the standardized appearance of the site. When using this template logout and check that it appears correctly with the default skin in Internet Explorer and a Acid2 compatible browser (or Firefox). Consult the following pages for placement elucidation Help:Section#Floating the TOC and Wikipedia:How to fix bunched-up edit links

  • Avoid placing the TOC in a visually poor location. Crossing a section division is probably a poor idea.
  • If the TOC is floated left of a bulleted list, the bullets will be hidden.

Site wide floating of TOC code

Add to your userpage/monobook.css (if your using the default monobook skin)

#bodyContent #toc {
 float: right;
 clear: right;
 margin: 0.3em;
}

A more advanced (non IE users) using the CSS child selector to prevent existing TOC layout scheme from causing problems and allowing the TOC to float next to existing images.

#bodyContent > #toc, #wikiPreview > #toc {
 float: right;
 clear: none;
 padding: 0.2em;
 margin: 0.3em;
}