div, align and css

S

skibud2

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>
</div>


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,

Mike
 
B

Ben C

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>
</div>


The CSS style:
.right {text-align: right;}
does not work for non text.

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.
Am I stuck with putting the align attribute directly in? I don't want
to use float because this div is within a table.

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.
 
D

David Dorward

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>
</div>

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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top