kralco626 kralco626 - 3 months ago 6
CSS Question

Nesting CSS classes

Can I do something like the following?

.class1{some stuff}

.class2{class1;some more stuff}


Not possible with vanilla CSS. However you can use something like:

Sass makes CSS fun again. Sass is an extension of CSS3, adding nested rules, variables, mixins, selector inheritance, and more. It’s translated to well-formatted, standard CSS using the command line tool or a web-framework plugin.


Rather than constructing long selector names to specify inheritance, in Less you can simply nest selectors inside other selectors. This makes inheritance clear and style sheets shorter.


#header {
  color: red;
  a {
    font-weight: bold;
    text-decoration: none;