Contact Us

|

FriendFeed FriendFeed

|

follow us on twitter Twitter

|

 Rss Feed

|

Favorites Add to Favorites

Saturday, July 4, 2009

CSS class inherit one or more other classes?

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>

I heard that there is a tool called lesscss which iam not sure whether it will work in all the browsers. That tool might solve your problem, but do check for browser compatibility.

Labels:

1 Comments:

Anonymous hayati said...

sivas
bilecik
denizli
erzincan
uşak
İSZ

July 27, 2023 at 10:53:00 AM PDT  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home