Manual talk:CSS

Jump to navigation Jump to search

Can the devs please add more of the Wikipedia css to the default MediaWiki? Such as wikitable.

How can you use custom CSS files in pages.

Eg I added MediaWiki:customFile.css

How can I access those classes?

You can import it via JavaScript placed in MediaWiki:Common.js--Juan de Vojníkov 10:05, 12 November 2010 (UTC)


This is probably the wrong place, but I was wondering, is it possible to set up in your personal css to link to a location other than the Main Page from the logo in the corner? The dark lord trombonator 03:13, 9 September 2009 (UTC)

This might be possible, but not by CSS. JavaScript or a function to localsettings.php. I dont know.--Juan de Vojníkov 10:05, 12 November 2010 (UTC)

Color a red link[edit]

What is the hex code for the color of red links on Mediawiki (that haven't been clicked on) under the default configuration? Tisane 12:00, 12 March 2010 (UTC)

On English Wikipedie in monobook style it is #ba0000.--Juan de Vojníkov 10:05, 12 November 2010 (UTC)


I think that it is worth mentioning that $wgUseSiteCss must be set to true in order for MediaWiki:Common.css, MediaWiki:Monobook.css, etc. to function.

I ran into this problem today.

Redirect CSS based on Browser[edit]

Has anyone been able to add a function to the JS page, that would allow a Admin/Developer to redirect the CSS use of a site to a Browser specific page?

Basics for use:

  1. Make a Browser Specific CSS page (for example: Common.css/IE8, IE8Common.css, Common.css/FF/6, etc)
  2. Have the site include both the core Common.css and the Browser Specific article form. The Browser page would potential override the Common.css styles or further build on the styles.

The ultimate goal is to allow for Browser specific Elements of CSS to be built and utilized in the wiki.

Thanks in advance, Goldbishop 03:22, 5 February 2012 (UTC)

Mediawiki already does that by default, although it is included on the head of the HTML, don't know if you could do it another way, here's how it looks like:

<!--[if lt IE 5.5000]><style type="text/css">@import "/skins/monobook/IE50Fixes.css?116";</style><![endif]-->
		<!--[if IE 5.5000]><style type="text/css">@import "/skins/monobook/IE55Fixes.css?116";</style><![endif]-->
		<!--[if IE 6]><style type="text/css">@import "/skins/monobook/IE60Fixes.css?116";</style><![endif]-->
		<!--[if IE 7]><style type="text/css">@import "/skins/monobook/IE70Fixes.css?116";</style><![endif]-->
		<!--[if lt IE 7]><script type="text/javascript" src="/skins/common/IEFixes.js?116"></script>


Thanx....didnt think of doing that ;) Goldbishop (talk) 13:49, 12 June 2012 (UTC)

Change redlink color[edit]

Using vector on a new 1.19 install. Where/how can I change the color of redlinks? RiverStyx23 (talk) 03:09, 22 January 2013 (UTC)

In MediaWiki:Common.css set, for example, .new {color: #009933 !important;} RiverStyx23 (talk) 03:17, 22 January 2013 (UTC)

Live preview[edit]

Would anyone know if it's possible for an MW update to ever have a way to do a live preview of stylesheet changes (being able to see the how the changes take effect before publishing them)? Schiffy (talk) 20:11, 18 January 2016 (UTC)

Highlighting title of non-empty discussion pages[edit]

Sorry if this is not the right place but I suppose that my request can be solved by some clever usage of Common.css but I do not know enough about it.

As the title says, I would like to make non-empty discussion pages more visible by providing them with a yellow back-ground for instance. They change color from red to blue so the background should be changeable as well, shouldn't it?

Thanks for your consideration! --Sm8ps (talk) 22:01, 16 February 2016 (UTC)

Just add span { background-color: green; } (or another color;) to your css. VanGore (talk) 13:30, 17 February 2016 (UTC)
Thanks a lot VanGore! Your hint got me going into the right direction. Taken as is, however, it colors red-links for non-existent discussion pages which is just the opposite of what I wanted. In order to get it working the way I wanted, I had to add the not-selector: #ca-talk:not(.new) span { background-color: Yellow; } --Sm8ps (talk) 21:28, 22 February 2016 (UTC)

Change CSS depending on Category[edit]

I don't suppose there's any reasonable way to use a different CSS per category? I know you can use namespace codes to change it by namespace, but changing CSS by way of the [[Category:]] on the page is not an ability I can find anywhere. -- 13:26, 3 November 2016 (UTC)