Right Align Table?

Problem

This code:

<table border="1">
    <tr>
        <th>a</th>
        <th>b</th>
        <th>c</th>
        <th>d</th>
    </tr>
</table>

http://jsfiddle.net/ca86D/ Generates:

a | b | c | d

How can i make it generate :

d | c | b | a

?

Without changing the order of the < th >

Problem courtesy of: Danpe

Solution

You can add dir="rtl" attribute to table:

<table border="1" dir="rtl">
    <tr>
        <th>a</th>
        <th>b</th>
        <th>c</th>
        <th>d</th>
    </tr>
</table>

Demo: http://jsfiddle.net/74XHk/1/

(tried to add it to tr, that didn't work)

Solution courtesy of: welldan97

Discussion

Surely just

<table border="1">
     <tr>         
         <th>d</th>
         <th>c</th>
         <th>b</th>
         <th>a</th>
     </tr>
</table> 

Hope I didn't misunderstand your question.

Discussion courtesy of: Ash Burlaczenko
<table border="1">
    <tr>
        <th>d</th>
        <th>c</th>
        <th>b</th>
        <th>a</th>
    </tr>
</table>
Discussion courtesy of: Jimmy Geers

add in your css th {float:right}. This will reverse the sequence, because will start with first th which contains d and will float it at right, then the second and so on.

Demo: http://jsfiddle.net/ca86D/2/

Discussion courtesy of: Sotiris

This recipe can be found in it's original form on Stack Over Flow.