Cyril
Cyril

Reputation: 1236

Adding align property in CSS2.0

I have a table , and the style for one particular td is

<td style="vertical-align: middle;align: center!important; height: 200px; background-color: #ffffff;text-align: -moz-center!important;width: 180px;">

The problem is , if I use text-align:center , it is working fine for Document Mode :IE7. But if I change the document mode to IE9. The alignment is in left.Then I used developer tool to test it. If I use align:center , it is working fine for both document modes. Now when I tried to add it in my code, it showing CSS warning that "align is not a known CSS property name". Eventhough If I suppress the warning, when I execute the code the align atrribute is not adding in my style.

Can anyone tell me how to fix this ?

Upvotes: 1

Views: 533

Answers (1)

yeyene
yeyene

Reputation: 7380

align="center" is used like that,

<td align="center">text</td>

text-align:center is used in style="..."

<td align="center" style="text-align:center">text</td>

Use this,

<td align="center" style="vertical-align: middle; text-align:center; height: 200px; background-color: #ccc;text-align: -moz-center!important;width: 180px;">

Upvotes: 1

Related Questions