views:

136

answers:

4

I have a fairly simple cell in a table with an inline style:

<td style="text-align: right;"> Current Status: </td>

And the text-align-right is being ignored, both in Firefox and Opera. I used Firefox's "firebug", and it shows me <td style=""> for this.

Any idea what could be going on? I thought that an inline style specified this way took highest priority over any linked style sheet or inherited style.

Thanks as always.

A: 

try to set width to your cell.

Skay
+1  A: 

Usually Firebug does that when there is an error with the style declaration.

Sinan
altough it seems okç
Sinan
Yep, but OP should definitely double-check production code to make sure it matches the example code precisely.
D_N
A: 

I don't think you can specify text alignment within a td tag. However, you can set the alignment of the contents of the td like this:

<td align="right"> Current Status: </td>
Clayton
A CSS text-align should work find for td tags. By using align you're messing up the separation of content and layout, which you should avoid.
Anne Schuessler
A: 

There are numerous ways to test what is going on here. Work through your CSS's classes in FireBug and enable and disable styles until you get a result your expecting. There is obviously some style declaration error some where that is causing this particular style to fail. Because you are right, inline styles take priority over external style sheets, and over parent styles. Since you know this focus on the table area of your HTML and see if there are any syntax errors, scripts that are overriding the value, etc.

Also test different text styles for this "td" tag to see if other styles work, such as:

color: blue;
line-height: 10px;
letter-spacing: 5px;

Also note that text-align:left is a default value if the direction property is "ltr" (left to right) which is default. So it could be possible that some of your styles for this HTML table element are not being applied.

contactmatt