Jump to content
  • Advertisement
Sign in to follow this  
johnnyBravo

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

This topic is 4702 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!