0

Here's what I'm trying to do:

var node = document.getElementById('some-object');
node.style.flex = '480px 1 0';

Question is, why doesn't the snippet above work on IE 10?

I can set the flex or flexBasis or flexGrow or whatsoever in IE11 and above, so why doesn't it work in IE 10?

Asons
  • 84,923
  • 12
  • 110
  • 165
Jerome Indefenzo
  • 967
  • 6
  • 25
  • That is an incorrect value for `flex` and IE 10 only supports the `-ms-` prefixed version of flex (partial support) – zgood Nov 28 '17 at 14:59
  • As IE10 use prefixed properties for Flexbox (the older version of it), you need to do the same with your script. `var node = document.getElementById('some-object'); node.style.msFlex = '1 0 480px'; /* flex: */` _And note, the `flex-basis` value should be last_ – Asons Nov 28 '17 at 17:19
  • @LGSon that's actually the method I found. No idea why I can set `msFlex` via javascript but not `msFlexBasis`. Any reason why the flex-basis needs to be last, though? – Jerome Indefenzo Nov 29 '17 at 21:01
  • It seems to work either way (specifically setting `{???}px 0 0`, that is). – Jerome Indefenzo Nov 29 '17 at 21:02

2 Answers2

0

This doesn't work because flexbox styling isn't supported in IE versions older than 11.

Cerbrus
  • 70,800
  • 18
  • 132
  • 147
0

It's not supported by IE10, have a look here which browsers support flexbox: https://caniuse.com/#search=flexbox Note, IE11 has only partial support.

lehel
  • 431
  • 4
  • 10
  • This is wrong, IE10 supports Flexbox, though the older version, using prefixed properties, and IE11 supports it, though partial support due to large amount of bugs present. – Asons Nov 28 '17 at 17:04