CSS flexbox not working in IE10 - css

In IE10, this code isn't working correctly:
.flexbox form {
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
-webkit-flex-direction: row;
-moz-flex-direction: row;
-ms-flex-direction: row;
-o-flex-direction: row;
flex-direction: row;
}
.flexbox form input[type=submit] {
width: 31px;
}
.flexbox form input[type=text] {
width: auto;
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
-webkit-flex: auto 1;
-moz-flex: auto 1;
-ms-flex: auto 1;
-o-flex: auto 1;
flex: auto 1;
}
What should happen is that input[type=submit] should be 31px wide, with input[type=text] taking up the rest of the available space within form. What happens is input[type=text] just defaults to 263px for some reason.
This works fine in Chrome and Firefox.

Flex layout modes are not (fully) natively supported in IE yet. IE10 implements the "tween" version of the spec which is not fully recent, but still works.
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Flexible_boxes
This CSS-Tricks article has some advice on cross-browser use of flexbox (including IE):
http://css-tricks.com/using-flexbox/
edit: after a bit more research, IE10 flexbox layout mode implemented current to the March 2012 W3C draft spec: http://www.w3.org/TR/2012/WD-css3-flexbox-20120322/
The most current draft is a year or so more recent: http://dev.w3.org/csswg/css-flexbox/

As Ennui mentioned, IE 10 supports the -ms prefixed version of Flexbox (IE 11 supports it unprefixed). The errors I can see in your code are:
You should have display: -ms-flexbox instead of display: -ms-flex
I think you should specify all 3 flex values, like flex: 0 1 auto to avoid ambiguity
So the final updated code is...
.flexbox form {
display: -webkit-flex;
display: -moz-flex;
display: -ms-flexbox;
display: -o-flex;
display: flex;
/* Direction defaults to 'row', so not really necessary to specify */
-webkit-flex-direction: row;
-moz-flex-direction: row;
-ms-flex-direction: row;
-o-flex-direction: row;
flex-direction: row;
}
.flexbox form input[type=submit] {
width: 31px;
}
.flexbox form input[type=text] {
width: auto;
/* Flex should have 3 values which is shorthand for
<flex-grow> <flex-shrink> <flex-basis> */
-webkit-flex: 1 1 auto;
-moz-flex: 1 1 auto;
-ms-flex: 1 1 auto;
-o-flex: 1 1 auto;
flex: 1 1 auto;
/* I don't think you need 'display: flex' on child elements * /
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
/**/
}

IE10 has uses the old syntax. So:
display: -ms-flexbox; /* will work on IE10 */
display: flex; /* is new syntax, will not work on IE10 */
see css-tricks.com/snippets/css/a-guide-to-flexbox:
(tweener) means an odd unofficial syntax from [2012] (e.g. display: flexbox;)

Related

Css style works in Safari, but displays different in chrome/safari.Does Flex work differently in Chrome/firefox? what am i missing?

i've been scratching my head all day, not knowing where to look.
The first image(left), Safari output is the result i'm expecting, but somehow in Chrome it works differently. My only conclusion is that flex works differently on chrome, but i'm not sure.
I know my css works, because i can get the expected output in safari.
I'm hoping someone can point me in the right direction. Any suggestions or links is very much appreciated. thanks.
fieldset.property{
display: -moz-box;
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex; flex-flow: row nowrap;
border-radius: 5px; border: 1px solid currentcolor;
margin: 10px 0;
}
fieldset.reference{
display: -moz-box;
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
flex-flow: column wrap;
border-radius: 5px; border: 1px solid currentcolor;
margin: 10px 0;
}
.radio_wrap, .unit_wrap{border: 1px solid yellow;}
fieldset.property .radio_wrap{
display: -moz-box;
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
flex: 0 0 30%;
display: flex; flex-flow: column nowrap;
align-items: flex-start;
padding: 15px 0;
}
fieldset.property .unit_wrap{
display: -moz-box;
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
flex: auto;
display: flex; flex-flow: column nowrap;
}
Bro try this
display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6, BB7 */
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Safari 6.1+. iOS 7.1+, BB10 */
display: flex; /* NEW, Spec - Firefox, Chrome, Opera */
Worked for me
Finally found out what was wrong with my code, long story short, one cannot set fieldset to display:flex.
Thanks to all who tried to help.
reference:
Why can't <fieldset> be flex containers?

Flex and flex-direction: column; IE11 Issue

Got a bit of a weird issue, I've got a lot of overlapping content in IE11 when using flex and flex-direction: column.
I've read a number of answers on here that suggested using flex: 1 and this didn't seem to fix my issue. Anyone got any other suggestions as to what I could be missing here?
Thank you in advance,
Nick
Broken Site URL: http://8b220f.3.ekm.shop
.c-product--compact .c-product__attributes-wrapper {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: end;
-ms-flex-pack: end;
justify-content: flex-end;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
}
.o-grid__item {
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding-left: 1.5rem;
width: 100%;
}
There are some bugs in IE10-11 (and other browsers) implementaion of flexbox - you can read about them here
Try setting flex: 1 1 auto; instead of flex: 1; on flex-children.

Can't get flexbox to work in IE/Safari

This all works perfectly in Chrome on my MBP, but breaks endlessly on the other browsers. I have used, https://autoprefixer.github.io/ to generate the necessary prefixes but to no avail.
Maybe someone can spot where I am going wrong? I striped the prefixed code out because I don't know what is affecting what now, so it's a bit of a blank slate... Heres the code and associated screenshots
Code is modified because of so many diff nested div's in here. Order will be parent > child etc..
.recommendation-modal {
display: flex;
justify-content: flex-start;
flex-direction: row;
align-items: flex-start;
background: #FFFFFF;
z-index: 202;
width: 100%;
max-width: 800px;
height: 70vh;
.rec-right--container {
display: flex;
flex-direction: column;
flex: 1;
width: 100%;
height: 100%;
background-color: #4B77BE;
color: #fff;
.rec-right--body {
display: -moz-flex;
display: -webkit-flex;
display: -ms-flex;
display: flex;
-moz-flex-direction: column;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
padding: 20px;
height: 100%;
#media (max-width: $screen-sm) {
flex-direction: row;
}
Ended up just needing to add the old syntax, I basically just found every old syntax possible and threw them in there until it worked...

-moz-box-flex does not work

Why -moz-box-flex does not work in firefox?
Do i use an old syntax? I do need display -moz-box otherwise my whole layout doesn't work in firefox. It does work in chrome and safari. What's wrong?
.container{
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
display: -moz-box;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-moz-box-direction: column;
width: 100%;
height: auto;
}
.item{
flex: 1;
-moz-box-flex: 1;
-webkit-box-flex: 1;
}
You do not need to use vendor prefixes for flexbox in Firefox, unless you're coding for Firefox 27 or older. Firefox 27 was released in February 2014.
Since Firefox 28 (released March 2014) all flexbox properties have been supported without prefixes.
See flexbox browser support table: http://caniuse.com/#search=flexbox

Flexbox IE10 width issues

The problem is that in IE10, the width of the columns inside the row is being calculated wrong, it appears to be adding on the width of the column margins (in total 80px), but in Firefox and Chrome it calculates it perfectly and fits everything inside 1260px. The main issue is that i have prefixed everything in what i believe is the right way, but i still get the issue.
You can see it here on jsFiddle - http://jsfiddle.net/andyjh07/ue2zfga6/
CSS:
.row {
width: 100%;
position: relative;
background: red;
display: box;
display: -webkit-flex;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
box-orient: vertical;
-webkit-flex-direction: column;
-moz-flex-direction: column;
flex-direction: column;
-ms-flex-direction: column;
margin-bottom: 40px; }
.row:after {
content: "";
display: table;
clear: both; }
.row *[class^="col-"] {
position: relative;
display: block;
height: auto; }
.row *[class^="col-"]:first-child {
margin-left: 0; }
#media (min-width: 64em) {
.row {
box-orient: horizontal;
-webkit-flex-direction: row;
-moz-flex-direction: row;
flex-direction: row;
-ms-flex-direction: row; } }
#media (min-width: 78.75em) {
.row {
max-width: 78.75em;
margin: 0 auto; } }
.col-one-third {
width: 100%;
background: blue; }
#media (min-width: 64em) {
.col-one-third {
width: 33.3%;
margin-left: 40px; } }
.col-two-thirds {
width: 66.7%;
margin-left: 40px;
background: blue; }
How it looks on Chrome, IE11, Firefox
How it looks on IE 10, emulated inside IE11's dev console/tools
As you can see, the margin's are being added and going beyond the width of the container
I don't have IE10 available, but it seems like you should look at caniuse.com and the known issues. Or maybe this user moderated list on Github. Or maybe the comment section of the css-tricks guide.
The caniuse site mentions:
IE10 and IE11 default values for flex are 0 0 auto rather than 0 1 auto, as per the draft spec, as of September 2013.
and
In IE10 and IE11, containers with display: flex and flex-direction: column will not properly calculate their flexed childrens' sizes if the container has min-height but no explicit height property.
The Github site mentions:
When using align-items:center on a flex container in the column direction, the contents of flex item, if too big, will overflow their container in IE 10-11.
Workaround
Most of the time, this can be fixed by simply setting max-width:100% on the flex item. If the flex item has a padding or border set, you'll also need to make sure to use box-sizing:border-box to account for that space. If the flex item has a margin, using box-sizing alone will not work, so you may need to use a container element with padding instead.
This comment on css-tricks shows that where you would normally say flex: 1; you should say -ms-flex: 1 0 auto;
Also, you should change your code where it does something like this:
-webkit-flex-direction: column;
-moz-flex-direction: column;
flex-direction: column;
-ms-flex-direction: column;
to this:
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
You always want the proper line of code—the one without flags— at the bottom of the prefix list.

Resources