padding trouble with tag - Post ID 1805

User 355448 Photo


Ambassador
3,144 posts

Once again, I have something I can't get to work. I understand the CSS Box model, with margin, border, padding, content (starting outside and working in.

I have a page http://www.roberson-family.com/genealogy/names.php where I want the left column items to have headers (Surnames) and a small indent for the individual names under the surnames.

I know I can get what I want by adding a pair of (& n b s p ; )s, and I can get the padding to work with inline css (style="padding-left=10px") but I wanted to use one entry to get everything done. I have every line of code where I want the indent set to be <td class="person"> and I have this style statement:

td.person {
width:33%;
font-size:medium;
text-align:left;
padding-left: 2cm;
}

I have also tried setting the padding using 10px, but had no indent with that.

Is this not what I should be doing with padding?
User 463058 Photo


Ambassador
1,073 posts

Hi Bill,

Take a look at this page:
http://www.stuffandnonsense.co.uk/archi … _wars.html

Your "#alpha td" rule has a higher specificity than "td.person", so the later rule's padding is ignored. Just change "td.person" to "#alpha td.person".
User 355448 Photo


Ambassador
3,144 posts

Cary,

Thanks. Just recently, I saw an article about specificity on about.com and saved it for later reading. Guess I should have read it right then. Now that I have the issue with my page solved, I am beginning to understand specificity.

I learn something about web sites every day.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.