Similarly to this question, I'd like to tweak where the default ToC appears in my MediaWiki site. Currently it appears at the first header, but occasionally I have significant content in the first paragraphs, before any headers.

Is there any way to make the ToC top-aligned with the page, rather than with the first header?

  • 1
    According to a guideline of the English Wikipedia, the lead section should not be more than four paragraphs long. You might consider adopting similar guideline on your wiki.
    – svick
    Mar 3 '13 at 20:41
  • Agreed. But even two short paragraphs, or one paragraph and a small table or other special content, can bury the ToC further than I'd like.
    – user35512
    Mar 4 '13 at 2:16

As written in one of the answers, ToC can be added anywhere to your page by using the following keyword:


If you want to add TOC to same place on every page, you can do so by styling it in your MediaWiki:Common.css wiki page (which gets added to CSS for all skins used, see an example of such page on Wikipedia). Something along the lines of this might work:

#toc { position: absolute; top: 2em; right: 0.5em; };
  • That's something, but it requires making an adjustment on each page. Is there a way to make the ToC appear at the top of the page by default?
    – user35512
    Mar 6 '13 at 3:04
  • You can set it to static positioning in global CSS.
    – che
    Mar 7 '13 at 13:03
  • Great! How? Put it in an answer and I'll gladly accept it.
    – user35512
    Mar 7 '13 at 22:28
  • Added a rough attempt :-)
    – che
    Mar 7 '13 at 22:37
  • So close! That does put the ToC in the top-right corner, but now it overlays content instead of flowing as it did when it was float: right;. If I was writing an ordinary web page, floating would be perfect, because I could change the insertion point.
    – user35512
    Mar 8 '13 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy