I\'m trying to convert old layout based on tables and JS to the new Flexbox with backward compatibility by keeping the tables for old browsers (specifically IE8, IE9 and Opera 1
As Danield has mentioned, all children of a flex container (designated by display: flex
or display: inline-flex
) are automatically made flex items. There is no display
property for a flex item; instead, you set it to some other value depending on how you want the children of the flex item to be laid out. If browsers are recognizing display: flex-item
, then they probably have some weird non-standard implementation of "flexbox", because that value has never existed in any incarnation of the Flexbox spec (and I have no idea what exactly it would correspond to if it did).
The initial value of display
is inline
, so display: initial
is equivalent to display: inline
. See this answer. What you're trying to do is reset the elements to whatever their default display
is as given by browsers. You will need to know this value in advance; for div
elements it's display: block
.
Unfortunately, this will override the existing table-cell
declaration in all browsers, for obvious reasons. In that case, you might as well just stick with the table layout if it already works for you, if you need to support browsers that don't support flexbox.