views:

114

answers:

2

I would like to be able to hide the whole sidebar (navigation, search, toolbox) and reclaim the space. In other words, the page should widen to fill the space used by the sidebar.

I don't want to do this for every page but only for specific pages, so preferably using a template.

I have got a template which hides the sidebar but, crucially, does not reclaim the space:

<css>
#column-content {margin: 0 0 .6em 0;}
#content {margin: 2.8em 0 0 0;}
#p-logo, .generated-sidebar,
#p-lang,
#p-tb,
#p-search {display:none;}
#p-cactions {left: .1em;}
#footer {display:none;}
</css>

This is using the PageCSS extension.

Anyone know I can I modify this to reclaim the space - or have another solution?

Update: After help from Adrian Archer (see below) I've discovered that the problem is in my customized skin. Reclaiming the space does work with Monobook. Anyone know what the particular part of the monobook skin is I need to copy? I've tried several things and I think it is in main.css but I'm not sure.

+1  A: 

Try putting your code in the Common.css to make sure it is correct.

The only thing I can think could be the problem (and I am not a CSS expert) is that it is being loaded at the wrong time. Try putting it not in a template, does it work then?

Adrian Archer
Thanks for the reply Adrian - I've not been able to try out your suggestion yet - will reply as soon as I can. Note though that the code above does work (hides navigation bar) but I want the page to shift to the left to reclaim that space.
Mark Robinson
the FAQ ( http://www.mediawiki.org/wiki/Manual:FAQ#How_do_I_hide_the_left_vertical_navigation_toolbar ) seems to indicate that it should reclaim that space. When I put that code at the bottom of my Common.CSS it did work as expected.
Adrian Archer
OK, thanks Adrian - I look forward to trying it out. So did that happen *for all* pages - how did you get it only to work for certain pages?
Mark Robinson
@Adrian - tried it (the version when F11 is pressed in MediaWiki:Common.js) but the screen area was not reclaimed.
Mark Robinson
@Adrian - also with the MediaWiki:Common.css version, it did not reclaim the space. I wonder why it worked for you?
Mark Robinson
Did you put it at the bottom of your MediaWiki:Common.css? I'm on version 1.13.3. What version are you on?
Adrian Archer
@Adrian - yes, at the bottom. That was tested on 1.15.4. Just to verify - your page *definitely* filled the space previously occupied by the sidebar, right? I'll try removing the other code from Common.css and try again.
Mark Robinson
Yea it did fill the space previously occupied by the sidebar.
Adrian Archer
Thanks again Adrian. Update: when I included *only* the text above in Common.css the search bar and toolbox remained. So I think it is a skin issue. When I used this: http://www.mediawiki.org/wiki/Manual:FAQ#How_do_I_hide_the_left_vertical_navigation_toolbar the whole sidebar vanished but did not reclaim the space. So I think it is a skin issue. I'll try other skins (we have a custom one).
Mark Robinson
Update: Adrian - it works with the Monobook skin - is that what you are using?
Mark Robinson
Yea I am using monobook. Good catch.
Adrian Archer
Thanks Adrian (and for your persistance here!). Any idea *why* monobook might behave differently to other skins?
Mark Robinson
+1  A: 

Thanks to Adrian Archer's help (see his response) + the hard work of a colleague, I have a working example (probably works for all skins). Create a template (e.g. Template:Hide sidebar) with these contents:

<css>
#column-content {margin: 0 0 .6em 0;}
#content {margin: 2.8em 0 0 0;}
#p-logo, .generated-sidebar, #p-lang, #p-tb, #p-search {
   display:none;
}
#p-cactions { left: .1em; }
#footer { display:none; }
#mw_content { margin-left:0.2em; }
</css>

Then just add {{Hide sidebar}} to any page you require it. The sidebar area will be reclaimed by the page. This difference with my question is the second to last line: #mw_content { margin-left:0.2em; }

Mark Robinson