Last modified: 2011-08-09 18:05:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T32292, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30292 - Add utility class to align element centered to shared CSS
Add utility class to align element centered to shared CSS
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
Interface (Other open bugs)
unspecified
All All
: Low enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-09 15:50 UTC by fryed-peach
Modified: 2011-08-09 18:05 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description fryed-peach 2011-08-09 15:50:18 UTC
There are floatright and floatleft classes to make div or table elements right- or left-floated. I want new "floatcenter" class for center-floated boxes. It would be fairly popular in English Wikipedia where {{center}} template is widely used. Possible implementation is:
<syntaxhighlight lang="css">
.floatcenter {
  width:auto;
  margin-left:auto;
  margin-right:auto;
}
</syntaxhighlight>
Comment 1 billinghurst 2011-08-09 15:54:27 UTC
Sounds like a local configuration that may be more appropriately asked at [[w:MediaWiki talk:Common.css]]
https://secure.wikimedia.org/wikipedia/en/wiki/MediaWiki_talk:Common.css
Comment 2 Krinkle 2011-08-09 16:18:14 UTC
No need for an additional class.

Instead of

  .floatcenter {
    width:auto;
    margin-left:auto;
    margin-right:auto;
  }
  <div class="floatcenter">

 (which is confusing since there is no such thing as a centered float in CSS).
Simply use:

  <div style="margin: 0 auto;">.

Or, if you want a utility class, add (or ask a sysop to add) the following to your local MediaWiki:Common.js:

  .aligncenter {
    margin-left: auto;
    margin-right: auto;
  }

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links