Align a table to right

<!DOCTYPE html>
<html>
<head>
<title>myPage</title>

<style type="text/css">
.width {width:300px}
.inner_background{background:#ffff00}
.outer_background{background:#00ffff}
.alignRight{text-align:right}

</style>

</head>
<body>
<table>
  <tr>
    <td class="width outer_background alignRight">
      myText
    </td>
  </tr>
</table>
 </body>
 </html>

I have the code above at http://dot.kr/x-test/test3.htm which is a temperal url.
“myText” is aligned to right end.

I have the code below at http://dot.kr/x-test/test2.htm which is a temperal url.
How can I align “myTable” to right end.


<!DOCTYPE html>
<html>
<head>
<title>myPage</title>

<style type="text/css">
.width {width:300px}
.inner_background{background:#ffff00}
.outer_background{background:#00ffff}
.alignRight{text-align:right}
</style>

</head>
<body>
<table class="width outer_background">
  <tr>
    <td class="alignRight">
      <table>
        <tr>
          <td class="inner_background">myTable</td>
        </tr>
      </table>
    </td>
  </tr>
</table>
 </body>
 </html>

You could try

td table {float: right;}

are you trying to align the TABLE element or the TEXT inside the TD?

there are SOOOOO many ways to align the table element ( including ralphs suggestion of float:right; )
this would work also:


.alignRight table{ display: inline-block;}

It is is best to see the intended structure’s of your whole page before choosing a specific technique ; CSS should NOT to be handled piece meal.

Why are you nesting tables in the first place. Tables are for tabular data and the chances that a piece of tabular data is itself a table of tabular data is extremely remote. Chances are that there are better tags to use to semantically identify what your content is than identifying it as tabular data that consists of tables of tabular data,