tags:

views:

100

answers:

1

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?

+3  A: 

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>
Greg
Tested in Chrome
Greg
Clever solution =) Have you tested it in more browsers? You could run it through http://www.browsershots.org/
Blixt
Nice answer. Easy solution.
Tony C
Interesting; didn't know about direction. However, this necessitates a wrapper element... Is this solution evil because it is an abuse of the property, or for another reason?
neezer
@neezer because it's an abuse of the direction property
Greg
you could also use float:right, which places #one first to the right, and #two second to the right.
txwikinger
@txwikinger he's trying to keep the display as table-cell - using float would force it to be block
Greg