Jump to content

breaking inheritance


jcombs_31

Recommended Posts

I guess this has never become a huge issue with me, but something I can't seem to get around.

 

If I set an element such as a paragraph

 

p {
  padding: 0;
}

 

and later decide I need a class to have some padding on the left

 

.padded {
  padding: 0 0 0 20px;
}

 

and then in my markup

 

<p class="padded">This padding is ignored based on my first padding</p>

 

How do I get around this?

Link to comment
Share on other sites

@jcombs download firebug (why is the FireFox3 release not finished!!!!) and you can see which rules are being applied to your markup very easily.

 

It is actuall better to just have #container .padded in fact its better to have the minimum amount of code possible whether it be css, xhtml or php!!!

 

reducing mass makes your projects much more maintainable..

Link to comment
Share on other sites

if .padded and/or p.padded isn't taking precedence over p, then you have a different CSS declaration that has the padding set to zero that is overpowering them. Both of the declarations are stronger than p alone.

 

Using firebug will show you which declaration is the strongest, and you can see where t hat declaration is coming from.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.