div, align and css

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi All,

How can I do the equivalent to the following in CSS.

This aligns the table to the right of the div
<div align = "right">
   <table> ..</table>

The CSS style:
.right {text-align: right;}
does not work for non text. Am I stuck with putting the align
attribute directly in? I don't want to use float because this div is
within a table.

Thanks in advance,


Re: div, align and css

Quoted text here. Click to load it

No, and there is no standard CSS property that does. Well actually,
that's not quite true, you _could_ use "direction: rtl" on the div,
which will cause the table to go to the right. But I wouldn't advise
using that unless the text is actually in Arabic or another rtl
language. It could well have undesired side-effects.

Quoted text here. Click to load it

So what? You can float things inside table cells, that's no problem.
Best to float: right the table, that's the CSS way to do this.

Re: div, align and css

Quoted text here. Click to load it

table {
  margin-left: auto;
  margin-right: 0;

Make sure you use a Doctype that triggers standards mode in IE.

David Dorward
http://dorward.me.uk /
http://blog.dorward.me.uk /

Site Timeline