text-align vs align

T

tshad

I am curious about using align="right" vs style="text-align:right".

I have set up styles to left justify my <td> tags (because of a problem with
having to using loose.dtd).

I have some <td> tags that I need to right justify and I assume that
align=right on specific tags would override the style. The problem was it
didn't. I did find that using style="text-align:right" would override the
style.

http://www.payrollworkshop.com/samples/testalignright1.htm
http://www.payrollworkshop.com/samples/testalignright2.htm

Why is that?

I had used style="vertical-align:top" before and was mentioned that it would
be better to use the valign=top.

What is the difference here?

Thanks,

Tom
 
D

David Dorward

tshad said:
I have some <td> tags that I need to right justify and I assume that
align=right on specific tags would override the style. The problem was it
didn't. I did find that using style="text-align:right" would override the
style.

See http://www.w3.org/TR/CSS21/cascade.html#q13

"The UA may choose to honor presentational attributes in an HTML source
document. If so, these attributes are translated to the corresponding CSS
rules with specificity equal to 0, and are treated as if they were inserted
at the start of the author style sheet. They may therefore be overridden by
subsequent style sheet rules."
 

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,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top