Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Tables, Invert order of displayed content

Tags:

html

css

I know this is a bit bleeding edge, but here's the question anyway:

Given

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

...

#one, #two { display: table-cell; }

... which gives me a lovely side-by-side arrangement of the div's with #one on the left and #two on the right.

Is there anyway to put #two on the left and #one on the right, using display: table-cell;, and without changing the order of the divs in the HTML?

I ask, because I'd like to keep #one above #two in the HTML for SEO reasons, but I'd like #two to be to the right of #one for aesthetic reasons. I know how to do this using floats/absolute positioning/margins/etc., but I was wondering if there was a way I can do it using the newer CSS table display properties (which I much prefer).

Any thoughts?

like image 555
neezer Avatar asked Jul 16 '09 16:07

neezer


1 Answers

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>
like image 139
Greg Avatar answered Sep 27 '22 22:09

Greg