开发者

How can I hide the sidebar in MediaWiki?

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.


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; }


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?


Maybe the answer is a little late..

Entering following line to the MediaWiki:Common.css hides the navigation bar on all pages

#mw-panel .body { visibility: hidden; }

or

#mw-panel .body { opacity: 0; }

To hide the bar on a specific page add

.page-Pagename #mw-panel .body { visibility: hidden; }

"Pagename" is the name of the page (capitalized). Be really careful when editing the MediaWiki:Common.css page!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜