Sign in to follow this  
johnnyBravo

[web] Css, how to make a class inherit off another class?

Recommended Posts

Hi, with the css, I want to have the leftinfobox, and rightinfobox inherit off the infobox class. .infobox{} .leftinfobox {float:left;} .rightinfobox{float:right;} how would i do this? Thanks

Share this post


Link to post
Share on other sites
You can't. Not in CSS only anyway (as far as I know). You can use multiple classes on the div though:


.infobox{}
.left (float: left; }
.right {float: right; }


<div class="infobox left">text</div>

Share this post


Link to post
Share on other sites
#list { width:200; font-weight:bold; background: #336699;}
#list ul,li {list-style-type: none;}

This way the the styles defined in #list will be passed on to UL and LI inside #list. Don't know if this is what you meant?

Share this post


Link to post
Share on other sites
I believe he means classic inheritance in a programming sense, in which case no, it doesn't. Multiple classes on a single element are probably the best bet.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this