CSS Tables, Invert order of displayed content

You can (ab)use the text direction warning, evil ahead:

<div id="container">
    <div id="one">First Div</div>
    <div id="two">Second Div</div>
</div>

<style>
    #container { direction: rtl; }
    #one, #two { display: table-cell; direction: ltr;}
</style>

    <div class="container">
        <div class="middle" style="background-color: blue;">
           <h4>Left Col placed middle</h4>
           <p>...</p>
        </div>
        <div class="right" style="background-color: red;">          
           <h4>Middle Col placed right side</h4>
           <p>...</p>
        </div>
        <div class="left" style="background-color: yellow;">
           <h4>Right Col placed left side</h4>
           <p>...</p>
        </div>
   </div>

<style type="text/css">
    .container {
        display: flex;
    }
    .container > .left{
        order:1;
    }
    .container > .middle{           
        order:2;
    }
    .container > .right{
        order:3;
    }

    .left, .middle, .right {
        display:table-cell;         
    }
 </style>

I use flexbox. You can also change count of divs. For example put more divs with left class, then they will be placed left side even if they are declared after.

I tried @Greg example, but it doesn't work on IE.

Tags:

Html

Css