Last modified: 2011-08-09 18:05: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>
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
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; }