- From: Aryeh Gregor <simetrical@gmail.com>
- Date: Mon, 4 Apr 2011 18:15:23 -0400
- To: Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no>
- Cc: www-archive@w3.org
On Sun, Apr 3, 2011 at 4:52 PM, Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no> wrote: > Actually, I believe it can easily be achieved with CSS: > > data:text/html,<!DOCTYPE html><style>div.center{text-align:center} > div.center *{margin-left:auto;margin-right:auto;}</style> > <div class="center">a > <div style="height: 1em; width: 10em; background: blue">b</div> > <div style="height: 1em; width: 20em; background: red" >c > <span style="display:inline-block;width:100px;background:yellow" >>d</span></div></div> > > Above I only used divs. But you can change the first <div> into > <center> and it will look the same. (Thre are no styles for <center> in > the above example.) Yes, you can always do specific examples. But you can't specify the behavior of <center> entirely in terms of CSS rules that will work for every document, while matching current browser behavior. If you think you can, try it. > http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#align-descendants > > I am not able to grok that particular paragraph that you link to there. > But 4 paragraphs above, <center> - together with <caption>(!) - is > mentioned and their CSS behaviour is described in clear, CSS terms: > > ]] The center element, the caption element unless specified otherwise > below, and the div, thead, tbody, tfoot, tr, td, and th elements when > they have an align attribute whose value is an ASCII case-insensitive > match for either the string "center" or the string "middle", are > expected to center text within themselves, as if they had their > 'text-align' property set to 'center' in a presentational hint, and to > align descendants to the center. [[ They must "align descendants to the center". That is defined in the paragraph I linked to; its meaning cannot be captured by CSS rules. For instance, the effect inherits in a way different from how CSS works.
Received on Monday, 4 April 2011 22:16:15 UTC