Skip to content

[css-flexbox] flex layout support for <button> #730

@jonkoops

Description

@jonkoops

I've been running into an interop issue between browsers when it comes to using flexbox in combination with the button element. According to the specification the display property "Applies to: all elements". But it looks like some browsers are not adhering to this due to inconsistencies in their implementation of the button element.

Test case:

<style>
  button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 64px;
    height: 64px;
    padding: 0;
    border: 0;
    background-color: blue;
  }

  .square {
    width: 32px;
    height: 32px;
    background-color: red;
  }
</style>
<button type="button">
  <div class="square"></div>
</button>

Expected result:

expected

Test results:

Browser Result Pass Bug tracker link
Chrome 54 chrome 👍 #262679 (fixed)
Safari 10.0.1 safari 👎 #148826
Firefox 50 firefox 👎 #984869, #1230207 (fixed)
Edge 38 edge 👍 Not available
IE 11 ie 👍 Not available

Some of the links are about the fieldset element, but still contain useful information.

Related links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions