MediaWiki talk:Common.css: Difference between revisions

From Xen
Jump to navigationJump to search
Line 4: Line 4:
:[[File:Sample-HTML-Catlinks.png]]
:[[File:Sample-HTML-Catlinks.png]]


[[User:Lars.kurth|Lars.kurth]]: 12:32, 29 October 2014 (UTC) According to [http://code.tutsplus.com/tutorials/the-30-css-selectors-you-must-memorize--net-16048] maybe <pre>.catlinks a[href="/wiki/Special:Categories"] { ...</pre> instead of <pre>.catlinks a:first-of-type { ...</pre> will fix this
[[User:Lars.kurth|Lars.kurth]] 12:32, 29 October 2014 (UTC): According to [http://code.tutsplus.com/tutorials/the-30-css-selectors-you-must-memorize--net-16048] maybe <pre>.catlinks a[href="/wiki/Special:Categories"] { ...</pre> instead of <pre>.catlinks a:first-of-type { ...</pre> will fix this

Revision as of 12:33, 29 October 2014

12. Category Links not rendering first element differently

Lars.kurth 11:51, 29 October 2014 (UTC): Hi, this may be a template or CSS issue. All pages that are in a Category have the Category link in them which points to a list of all categories. Probably the Category link should be visually different, but as far as I recall there is no easy way for an CSS style sheet to achieve this, without making some code changes to Mediawiki. Wikipedia and all other Mediawiki instances do the same, but it just renders differently, aka

Categories: Cat1 Cat2 ...

There seems to be some clever logic in Mediawiki, which uses "Category" as label when a page is in one category only and uses "Categories" when the page is in several categories, which I guess is where the confusion comes from. I was originally looking at some CSS wizardry to make the first button look different, but am not enough of a CSS expert to make this happen. The relevant code is in MediaWiki:Common.css under /** 12. Category Links **/. The idea is that .catlinks a:first-of-type should render the first button differently, but it does not appear to work. Playing a little bit with this: what seems to happen is that first-of-type is applied to all elements in this structure. The picture below shows the corresponding html for the CSS. Maybe someone with more CSS skills can fix it or make a suggestion

Sample-HTML-Catlinks.png

Lars.kurth 12:32, 29 October 2014 (UTC): According to [1] maybe

.catlinks a[href="/wiki/Special:Categories"] { ...

instead of

.catlinks a:first-of-type { ...

will fix this