Difference between revisions of "MediaWiki talk:Common.css"

From Bogleheads
Jump to navigation Jump to search
(Clarified that the mobile UI is not affected.)
(Wiki core CSS override reverted.)
Line 79: Line 79:
The mobile UI uses a different message box and is not affected. --[[User:LadyGeek|LadyGeek]] 12:46, 30 October 2020 (UTC)
The mobile UI uses a different message box and is not affected. --[[User:LadyGeek|LadyGeek]] 12:46, 30 October 2020 (UTC)
:Due to formatting issues with [[Template:Ivory messagebox]], I have reverted this change. See: [[Template talk:Ivory messagebox]] --[[User:LadyGeek|LadyGeek]] 23:41, 31 October 2020 (UTC)

Latest revision as of 23:41, 31 October 2020

This page needs to be updated with content from Wikipedia's MediaWiki:Common.css so that we can use table classes, like infoboxes. Only an administrator can edit this page. --Spangineer (talk) 20:12, 11 September 2008 (UTC)

We don't need to update this page as frequently as Wikipedia, perhaps when the MediaWiki software is updated. Be sure to add the prosilver header below.

/* Implement phpBB prosilver navbar */
.headerbar {
   background-color: #12A3EB;
   background-image: url('http://www.bogleheads.org/forum/styles/prosilver/theme/images/bg_header.gif');
   color: #FFFFFF;

--LadyGeek 19:55, 20 November 2012 (CST)

The code is updated to match Wikipedia, but for the version dated 02 November 2013 (not the latest). One of the editors has disabled the default nowrap behaviour for list items in horizontal lists, which is causing quite a discussion in the Talk page (to fix IE problems). I'll wait for the dust to settle. --LadyGeek 17:05, 17 November 2013 (CST)

Disable display on desktop

Added a class to disable content display for desktops. MobileFrontEnd does not load MediaWiki:Common.css, so it won't see this class. See: Topic on Extension talk:MobileFrontend

/* Only for mobile devices */
.onlymobile {

Use class="nomobile" in conjunction with class="nomobile" to show content only on the desktop. This class is needed on the main page to have one table version for the desktop, another version for mobile. --LadyGeek 17:21, 17 April 2016 (EDT)

The above description is incorrect (class is described twice) and was based on a 2012 support question. Currently, class="nomobile" will prevent display in a mobile device without modification to MediaWiki:Mobile.css (no need to change anything now, maybe later). Modification to MediaWiki:Common.css is still needed to block display in a desktop device.
Class Display on Desktop Display on Mobile
nomobile Y N
onlymobile N Y
--LadyGeek 14:04, 8 April 2020 (UTC)

MediaWiki core CSS override

The upgrade to MediaWiki 1.35.0 introduced a breaking CSS change that is described in .messagebox :only-child (a topic in User talk:Volker E. (WMF)). MediaWiki is optimized for Wikipedia. We customize templates and styles for use here.

Wikipedia has taken the position that list items are "edge cases" and that the border issues are acceptable. In our case, the CSS within the MediaWiki core source code breaks Template:Ivory messagebox for list items and is not acceptable.

The relevant core CSS is in (path to wiki)/resources/src/mediawiki.skinning/messageBoxes.less.

.successbox {
	color: #000;
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	box-sizing: border-box;
	margin-bottom: 16px;
	border: 1px solid;
	padding: 12px 24px;
	word-wrap: break-word;
	/* Standard property is `overflow-wrap` */
	overflow-wrap: break-word;
	overflow: hidden;

/* Ensure box inner spacing is not all over the place no matter what element is only child. */
.messagebox :only-child,
.errorbox :only-child,
.warningbox :only-child,
.successbox :only-child {
	margin: 0;

Care should be taken to only make the minimum changes necessary to fix the issue. I have modified the CSS to add:

/* Override MediaWiki core */
.messagebox :only-child {
	margin: 0 0 0 16px;	

Note that using other CSS margin properties, such as margin-bottom, are different than margin and will not override the intended CSS. The exact property name must be used.

The mobile UI uses a different message box and is not affected. --LadyGeek 12:46, 30 October 2020 (UTC)

Due to formatting issues with Template:Ivory messagebox, I have reverted this change. See: Template talk:Ivory messagebox --LadyGeek 23:41, 31 October 2020 (UTC)