Difference between revisions of "Skin Adjustments"

From Organic Design wiki
m
(simply - use rules that widen the existing portlets too)
Line 13: Line 13:
 
These examples use pixel (px) widths which have the effect of locking down font sizes. You may wish to use to an em size instead, e.g. to something like 15em, if so just use proportions of this new em width.
 
These examples use pixel (px) widths which have the effect of locking down font sizes. You may wish to use to an em size instead, e.g. to something like 15em, if so just use proportions of this new em width.
  
{{code|<css>
+
{{code|<css>div#content,
div#content,
 
 
body.skin-vector div#footer,
 
body.skin-vector div#footer,
 
body.skin-vector div#mw-head-base {
 
body.skin-vector div#mw-head-base {
 
     margin-left: 248px;
 
     margin-left: 248px;
 
}
 
}
 +
body.skin-vector div#mw-panel,
 
body.skin-vector div#p-logo {
 
body.skin-vector div#p-logo {
 
     width: 248px;
 
     width: 248px;
Line 25: Line 25:
 
     left: 248px;
 
     left: 248px;
 
}
 
}
body.skin-monobook div#p-cactions {
+
body.skin-monobook div#column-content {
    left: 230px;
+
margin-left: -248px;
 
}
 
}
 +
body.skin-monobook #column-one .portlet,
 
body.skin-monobook div#p-logo {
 
body.skin-monobook div#p-logo {
 
     width: 230px;
 
     width: 230px;
 
}
 
}
</css>}}
+
body.skin-monobook #column-one #p-personal {
 
+
width: 100%;
 
 
In Monobook, adjusting the size of the existing portlets to fit the new sidebar size may be difficult, but in Vector you can resize them easily with the following CSS rule,
 
{{code|<css>
 
div#mw-panel { width: 248px }
 
</css>}}
 
 
 
 
 
Note that the search portlet (for instance) may be placed in the sidebar using absolute positioning e.g.:
 
{{code|<css>
 
#p-search {
 
    position: absolute;
 
    top: 160px;
 
    width: 230px;
 
 
}
 
}
</css>}}
+
body.skin-monobook div#p-cactions {
 
+
    left: 230px;
 +
}</css>}}
  
You can choose not to widen the logo width, but if you do and want to keep your original logo picture, you can centre it using the background selector.
 
 
[[Category:MediaWiki]]
 
[[Category:MediaWiki]]

Revision as of 13:33, 7 March 2012

Sometimes you want to widen the left column of a MediaWiki to use it for a tree-menu or similar. This article shows you how to do this in a way that works for both the Vector and Monobook skins. The example here sets the width to 248 pixels, but you can easily adjust it to your own width value.

This is done with CSS which needs to be added after the skin's native CSS loads, note that it should not be appended to existing files in the skin because you are then unable to upgrade your wiki without having to redo the changes to the files again. Instead you can put any CSS in the MediaWiki:Common.css article, or for a more efficient method put it in a file in your wiki's skins directory (in this example I've called it "wide-sidebar.css", and include it from LocalSettings.php as follows,

{{{1}}}


These examples use pixel (px) widths which have the effect of locking down font sizes. You may wish to use to an em size instead, e.g. to something like 15em, if so just use proportions of this new em width.


<css>div#content,

body.skin-vector div#footer, body.skin-vector div#mw-head-base {

   margin-left: 248px;

} body.skin-vector div#mw-panel, body.skin-vector div#p-logo {

   width: 248px;

} body.skin-vector div#left-navigation {

   left: 248px;

} body.skin-monobook div#column-content { margin-left: -248px; } body.skin-monobook #column-one .portlet, body.skin-monobook div#p-logo {

   width: 230px;

} body.skin-monobook #column-one #p-personal { width: 100%; } body.skin-monobook div#p-cactions {

   left: 230px;

}</css>