[whatwg] Alignment of empty buttons

Ian Hickson ian at hixie.ch
Fri Nov 22 15:00:35 PST 2013

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:


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


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


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

I've filed a bug to track this:


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

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

More information about the whatwg mailing list