Apparently Firefox doesn't like display: flex
on buttons. Is there a way to t correct this?
CSS:
button {
width: 100%;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
}
button div:first-child {
-webkit-box-ordinal-group: 2;
-webkit-order: 2;
-moz-box-ordinal-group: 2;
-ms-flex-order: 2;
order: 2;
}
button div:last-child {
-webkit-box-ordinal-group: 1;
-webkit-order: 1;
-moz-box-ordinal-group: 1;
-ms-flex-order: 1;
order: 1;
}
HTML:
<button>
<div>
<p>First</p>
</div>
<div>
<p>Second</p>
</div>
</button>
Live demo: http://jsbin.com/ziwadabo/2
Flexbox is very well supported across modern browsers, however there are a few issues that you might run into.
A flex layout can also wrap in multiple rows or columns and flexbox treats each row or column as a separate entity, based on its content and the available space. On the other hand, CSS Grid lets you work along two axes: horizontally and vertically.
position:fixed makes flexbox not workable, since it overrides the position of <p>Hello</p> Try to remove it and see the difference. If you want align-items:center works; try to set height: 100vh; since the body height of webview is not set to screen height by default.
tl;dr: Just put a div inside of your <button>
, and make that div display:flex
.
See https://bugzilla.mozilla.org/show_bug.cgi?id=984869#c2 for why display
doesn't do what you expect on <button>
in Firefox (and for similar things that don't work in Firefox or Webkit/Blink, for similar reasons).
Here's your modified jsbin: http://jsbin.com/ziwadabo/4/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With