2

I need to pad just one cell in my table. I gave the td element a class and defined the class in my CSS file like this

.itemQuantity { padding-right:30px; text-align:right; background-color: #EEE; } 

Padding-right does not seem to be doing anything.

2
  • 1
    Most likely some other rule has precedence. Have you checked the element with a debugger/DOM inspector such as Firebug? Commented Jul 13, 2010 at 15:32
  • Seems to be working for me in Firefox 3.6.6. For example, if I go to the link below and use Firebug to add that style to the Oranges' TD element and right align it, the entire left column becomes wider to accommodate the extra padding in that one cell, and the Orange text is aligned right, but spaced 30px from the right edge of it's cell due to the padding. I find it useful to experiment with styles in Firebug to rule out other interference. w3schools.com/html/html_tables.asp Commented Jul 13, 2010 at 15:36

1 Answer 1

2

I changed the css to

td.itemQuantity { padding-right:30px; text-align:right; background-color: #EEE; } 

Now it works.

Sign up to request clarification or add additional context in comments.

1 Comment

You probably need to read up on selector specificity: w3.org/TR/CSS2/cascade.html#specificity

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.