Difference between revisions of "Skin Adjustments"

From Organic Design wiki
m (Increase Monobook Sidebar from 12.2em to 248px)
m ({{legacy}})
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Sometimes you want to widen the left column of a MediaWiki to use it for a tree or similar. This article shows you how to do this in Vector and Monobook, using 248px as a width, though you will use your own custom width. This can all be done with CSS in both Vector and Monobook.
+
{{legacy}}
 +
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.
  
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.
+
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,
 +
<source lang="php">
 +
$wgExtensionFunctions[] = 'wfAddCss';
 +
function wfAddCss() {
 +
    global $wgOut;
 +
    $wgOut->addStyle( 'wide-sidebar.css', 'screen' );
 +
}
 +
</source>
  
== Increase Vector Sidebar from 10em to 248px ==
 
  
Either add this to the bottom of main-ltr.css (or screen.css on 1.18+) or make a new skin with these values.
+
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.
 
+
<source lang="css">
This is intended to replace the left sidebar content, so left portlets are disabled.
+
div#content,
{{code|<css>
+
body.skin-vector div#footer,
div#content { margin-left: 248px; }
+
body.skin-vector div#mw-head-base {
div#footer { margin-left: 248px }
+
    margin-left: 248px;
div#p-logo: { width: 248px }
+
}
div#mw-head-base { margin-left: 248px }
+
body.skin-vector div#mw-panel,
div#left-navigation { left: 248px }
+
body.skin-vector div#p-logo {
/* Disable left portlets */
+
    width: 248px;
div#mw-panel { display: none }
+
}
</css>}}
+
body.skin-vector div#left-navigation {
 
+
    left: 248px;
 
+
}
In Vector you can resize the left panel portlets, just substitute the last rule above with:
+
body.skin-monobook div#column-content {
{{code|<css>
+
margin-left: -248px;
div#mw-panel { width: 248px }
+
}
</css>}}
+
body.skin-monobook #column-one .portlet,
 
+
body.skin-monobook div#p-logo {
== Increase Monobook Sidebar from 12.2em to 248px ==
 
 
 
Either add this to the bottom of main.css or make a new skin with these values.
 
 
 
This is intended to replace the left sidebar content, so left portlets are disabled.
 
{{code|<css>
 
div#content { margin-left: 248px }
 
div#p-cactions { left: 230px }
 
div#p-logo { width: 230px }
 
/* Disable left portlets */
 
div#p-navigation, div#p-tb, div#p-search { display: none }
 
</css>}}
 
 
 
 
 
Note, 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;
 
     width: 230px;
 
}
 
}
</css>}}
+
body.skin-monobook #column-one #p-personal {
 
+
width: 100%;
 
+
}
You will need to remove it from the disabled elements above, and re-style the internal elements to compensate for the increased width.
+
body.skin-monobook div#p-cactions {
 
+
    left: 230px;
== Logo ==
+
}
 +
</source>
  
You can choose not to widen the logo width, but if you do and want to keep your original logo picture, you can center it using the background selector.
+
[[Category:MediaWiki]]

Latest revision as of 19:13, 27 January 2017

Legacy.svg Legacy: This article describes a concept that has been superseded in the course of ongoing development on the Organic Design wiki. Please do not develop this any further or base work on this concept, now this page is for historic record only.

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,

$wgExtensionFunctions[] = 'wfAddCss';
function wfAddCss() {
    global $wgOut;
    $wgOut->addStyle( 'wide-sidebar.css', 'screen' );
}


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.

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