Re: [whatwg] Alignment of empty buttons

On Thu, 5 Sep 2013, Boris Zbarsky wrote:
> On 9/5/13 4:47 PM, Ian Hickson wrote:
> > In what sense?
> 
> In the sense that if its computed display is "block" but its layout 
> behavior is not that of a non-replaced block (CSS 2.1 section 10.3.3 and 
> so forth), then it's clearly a replaced element with layout behavior 
> defined by something other than CSS.

Hm, it's true that <button>s do seem exceedingly eager to remain 
inline-block-esque even when set to more block-like display types.


> > The definition of "replaced element" here:
> > 
> >     http://www.w3.org/TR/CSS2/conform.html#replaced-element
> > 
> > ...doesn't seem to apply to <button>. The rendering of <button> is 
> > very much in CSS' scope, no?
> 
> Sure doesn't seem to be, since no UA actually renders <button 
> style="display: block"> the way a CSS block renders; they do something 
> totally different which is presumably covered by some other spec (e.g. 
> HTML).

The definition above talks only about the contents of the element, not 
the element itself, except that the element may have intrinsic dimensions. 
In the case of <button>, the contents are very much rendered by CSS. It's 
the element itself that defies CSS rules.

So it's something, but not a replaced element.

It does respond to 'display', just not as you'd expect. For example, 
setting it to display:table doesn't make it a table on the inside:

   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2650

Setting it to 'table-row' doesn't make it a row on the outside:

   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2651

Setting it to 'display:block' does seem to make a difference, though:

   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2652

Browsers (I mainly tested Gecko and WebKit) are remarkably interoperable 
around this.

I've filed a bug to track this:

   https://www.w3.org/Bugs/Public/show_bug.cgi?id=23893

If anyone has any suggestions on how to spec this, I'm eager to here 
them.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 22 November 2013 23:01:01 UTC