Posted By

webdevelopertut on 07/04/09


Tagged

css classes inherit


Versions (?)

CSS class inherit one or more other classes?


 / Published in: CSS
 

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

  1. Question:
  2. Is it possible to make a CSS class that "inherits" from another CSS class (or more than one).
  3.  
  4. For example:
  5.  
  6. .test { width:200px;display:block }
  7. .logo { background:#cc;border:1px solid #4d4d4d }
  8.  
  9. I'd like to do is something like this:
  10.  
  11. .combine
  12. {
  13. .test;
  14. .logo
  15. }
  16.  
  17. where the ".combine" class would use all the attributes like width 200px, display block, background color #ccc and border color.
  18.  
  19. Answer:
  20. 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.
  21.  
  22. For Example:
  23. <div class="test logo ">text text text</div>

Report this snippet  

You need to login to post a comment.