neca neca - 6 months ago 58
Less Question

Can you increase specifity by nesting class inside of another class?

Would this

.class{
.subclass{ }
}


be same as

.class{}
.subclass{}


are there any diffrences apart from visual ones?

Answer Source

Nesting in SASS does exactly that. It increases specificity of the selector.

Play with this gist on SassMeister.

.class {
  .subclass {
    color: red;
  }
}

compiles to:

.class .subclass {
  color: red;
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download