Manual talk:Interface/Stylesheets

From MediaWiki.org
Jump to navigation Jump to search

Seems not to work with 1.11.0[edit]

Hello, i recently found this function and i want my wiki to behave the way that depending on the namespace the background is different. I saw this in MediaWiki:Common.css, but when i add this to my Common.css nothing changes.

by the way: any changes made in my Common.css or Common.js does not seem to have an effect. Can anyone help me please? Thanks, --TurboKanne 12:50, 19 February 2008 (UTC)

Broken CSS links[edit]

Common.css and skinname.css (e.g. Vector.css) don’t seem to exist. Common.css was moved to Gadget-site.css without redirect, so I changed that link, but where is the default CSS for the skins located? And do the User: stylesheets still work? —Frungi (talk) 07:58, 25 May 2013 (UTC)

Common.css was moved on mediawiki.org because Extension:Gadgets was installed, so users can disable the load of the now old Common.css on their preferences disabling the "Gadget-site", for testing purposes for example. But this stylesheet is still being loaded --Ciencia Al Poder (talk) 14:35, 9 June 2013 (UTC)

MediaWiki:Skinname.css only works for Vector.css / Solved[edit]

I am using MediaWiki 1.24.1. If I change "MediaWiki/Vector.css" to

/** Hide sidebar **/
div#mw-panel {
  display: none;
}
#left-navigation {
  left: 0em;
}
#mw-head-base,
div#content,
div#footer {
  margin-left: 0em;
}

this works and the left navigation sidebar collapses. It does not work with cologneblue.css or modern.css or my custom skin. Off course I always purge the cache. In Localsettings.php I did declare:

$wgUseSiteCss = true;

Help would be much appreciated--Gogtl (talk) 12:51, 12 December 2015 (UTC).

Other skins may have different IDs for sidebar. Have you checked that the ID is correct on those skins? --Ciencia Al Poder (talk) 16:23, 12 December 2015 (UTC)
Thank you so much Ciencia Al Poder, this is the answer for cologneblue and modern. And your answer led me to the solution for the custom skin. The custom css was named wrongly: MediaWiki:SkinName.css was not read, but MediaWiki:Skinname.css was used. Now everything is working properly! I am so grateful! Kind regards,--Gogtl (talk) 18:31, 12 December 2015 (UTC)

print.css[edit]

Is print.css functioning? I did a quick test on wikipedia, and none of the loaded stylesheets seems to show what should be in wikipedia's print.css. --192.171.49.132 17:07, 5 February 2017 (UTC)

Will subpages of Common.css be applied globally?[edit]

If not, how to globally apply a css-type wiki-page?

Johnywhy (talk) 20:01, 8 June 2018 (UTC)

Add its contents to MediaWiki:Common.css, @import it (as URL) (not recommended) or install it as a gadget. --Ciencia Al Poder (talk) 09:23, 9 June 2018 (UTC)

Why is import not recommended?

It's BAD coding-style to put all CSS into a single file. So if MW requires that, that's a poor design. CSS associated with an extension should get it's own separate CSS page.

When i create a subpage to Common.css, eg Common.css/MyStyle.css, the subpage gets preloaded with

/* CSS placed here will be applied to all skins */

That seems to indicate that the CSS subpage will be applied to all skins. How to make that work? $wgUseSiteCss might be related, but i think that just activates Common.css, and it's enabled by default.


The gadgets page says

The Gadgets extension provides a way FOR USERS TO PICK JavaScript or CSS based "gadgets" that other wiki users provide.

That's different than global css. I don't want users to pick. Is it possible to make global css with Gadgets?

Seems to me, admin should not have to install gadgets or other extensions to create additional global CSS pages. Seems like it should be built-into MW. Johnywhy (talk) 14:10, 9 June 2018 (UTC)

It's not recommended for performance reasons, because imports make a new HTTP request to the server. Gadgets can be enabled by default, and hidden, effectively disallowing users from deactivating them. You can put several CSS and JS files inside the same gadget. Users can create additional CSS pages, as I said, without the need to use extensions. However, the way you should include them is not recommended. Since that's not an essential feature for MediaWiki, core does not provide exactly what you want. --Ciencia Al Poder (talk) 09:33, 10 June 2018 (UTC)