Class inheritence

How do I do the following:

.cpanel_body {
  background : white;
  border-width : 1px;
  border-style : solid;
  border-color : #000080;
  padding : 3px;
}

.nopad {
  padding : 0px;
}

I want nopad to inherit all the attributes of cpanel_body, and override padding.  so that I can do something like the following  <td class="cpanel_body,nopad"> ?
cayatesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arantiusCommented:
.cpanel_body, .nopad {
  background : white;
  border-width : 1px;
  border-style : solid;
  border-color : #000080;
  padding : 3px;
}

.nopad {
  padding : 0px;
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
seanpowellCommented:
I know we're closed off here, just a couple of points:

1. Only add what's required for the specific adjustment. That way we can reuse the nopad class much easier:

 .cpanel_body {
  background : white;
  border : 1px solid #000080;
  padding : 3px;
}

 .cpanel_body2 {
  background : red;
  border-width : 4px solid #ffcc66;
  padding : 20px;
}

.nopad {
  padding : 0px;
}

<div class="cpanel_body">Only cpanel_body styles applied</div>
<div class="cpanel_body2">Only cpanel_body2 styles applied</div>
<div class="cpanel_body no pad">White background, no padding</div>
<div class="cpanel_body2 no pad">Red background, no padding</div>

If we were to use the original example, we couldn't do the 4th div just listed becuase nopad included the white background.

2. This: <td class="cpanel_body,nopad"> should be this: <td class="cpanel_body nopad">

In other words, we need to saparate multiple classes with a space, not a comma.

That's all - stepping back out again :-)

Sean

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.