Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

According to the MediaWiki FAQ

A TOC is added automatically as soon as you have more than three headers.

which is fine and all, but I'd like it floated to the right, so that it does not take up a lot of vertical space at the top of the page.

How can I float the table of contents to the right?

share|improve this question
add comment

5 Answers 5

up vote 5 down vote accepted

Add

#toc { float: right };

to your MediaWiki:Common.css wiki page.

share|improve this answer
    
Brilliant! Thank you. –  Robert Munteanu Jul 16 '10 at 10:46
1  
For any noobs out there (like me), you can access this special page just like any other, with an URL like this: my.domain.com/MediaWiki/index.php?title=MediaWiki:Common.css –  Jon of All Trades Mar 3 '13 at 5:41
    
...or by writing the name to site's search box. –  che Mar 5 '13 at 11:30
add comment

For one page use

<div style="float:right;">__TOC__</div>

This is what I usually do. Being that I do a lot with styling and so forth, I hate using my user css to modify anything since then I don't see what everyone else sees and therefore don't know what a visitor will see.

share|improve this answer
add comment

Try using this in the Mediawiki:common.css file

#toc {float:right;margin:0 0 1em 1em;position:fixed;top:150px;right:10px;};

This not only places the floating TOC to the right, but also keeps it visible all the time while scrolling up and down the page.

share|improve this answer
add comment

If you just want to do it for one particular page and not all pages the following WikiMarkup should work (source):

{| align="right"
| __TOC__
|}
share|improve this answer
    
This has no effect on the TOC for me, although Arlen's div solution works. –  Sparr Feb 10 at 14:28
add comment

What exactly I have done to accomplish this:

  1. In the search box, type "MediaWiki:Common.css"
  2. You will see the MediaWiki:Common.css page that you can now "Create" if you have never made any modifications to id, or "Edit" if you have already created it.
  3. Add the following code: #toc {float:right;margin:0 0 1em 1em;position:fixed;top:150px;right:10px;}; and Save your changes.
  4. Make sure to clear your cache.
  5. Load a page with a Table of content

Thank you for pencilslate code.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.