Return to Snippet

Revision: 15404
at July 4, 2009 12:37 by webdevelopertut


Initial Code
Question:
Is it possible to make a CSS class that "inherits" from another CSS class (or more than one).

For example:

.test { width:200px;display:block }
.logo { background:#cc;border:1px solid #4d4d4d }

I'd like to do is something like this:

.combine
{
.test;
.logo
}

where the ".combine" class would use all the attributes like width 200px, display block, background color #ccc and border color.

Answer:
Good Question my friend. But i think you can't do something like that. It would be much helpful for a developer if this is possible! Instead you can use multiple classes to a single block element.

For Example:
<div class="test logo ">text text text</div>

Initial URL
http://htmlcsstutorials.blogspot.com/2009/07/css-class-inherit-one-or-more-other.html

Initial Description


Initial Title
CSS class inherit one or more other classes?

Initial Tags
css

Initial Language
CSS