Manual talk:CSS

Latest comment: 1 year ago by Ham Pastrami in topic Where are user-facing classes defined?

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)Reply

Query

edit

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)Reply

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)Reply
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)Reply

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

$wgUseSiteCss

edit

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)Reply

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>

--Anonymous

Thanx....didnt think of doing that ;) Goldbishop (talk) 13:49, 12 June 2012 (UTC)Reply
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)Reply

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

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)Reply

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)Reply

Just add #ca-talk.new span { background-color: green; } (or another color;) to your css. VanGore (talk) 13:30, 17 February 2016 (UTC)Reply
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)Reply

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. --194.83.236.250 13:26, 3 November 2016 (UTC)Reply

You cannot change or add CSS with "Category", but you can add CSS with templates. A template with the CSS and the category name inside the template, to assign a category and a CSS at the same time. And there's also possibilities with some extensions.

Dead link: page deleted

edit

The "hard refresh" link, showed in this article, goes to a deleted page.

Where is Common.css?

edit
It would be good if the article said where common.css is located. That's what I've been searching for for some time as a novice.

Permissions

edit

Per default ordinary users are not permitted to edit MediaWiki:Common.css. You must be Administrator.

"mw-contris" class typo?

edit

I have observed that the CSS class for the "Contributions" link in the personal menu is ".pt-mycontris", but for unregistered users ".pt-anoncontribs".

Is the former a historical typo or deliberate? Just asking out of curiousity. Marcus Alanius (talk) 21:47, 17 August 2021 (UTC)Reply

Where are user-facing classes defined?

edit

Such as wikitable. These used to be present in the shipped Common.css but have since been moved out of there. Where did they go? Ham Pastrami (talk) 04:56, 7 July 2023 (UTC)Reply

Return to "CSS" page.