O'Reilly logo

Getting Started with Zurb Foundation 4 by Andrew D. Patterson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extending classes

An alternative to including a mixin with predefined properties is to extend classes. It defines a new class that inherits all the properties of another class. The following is an example:

.emphasis {
  font-weight: bold;
  background-color: #ffffaa;
  font-size: emCalc(24);
}
.special-emphasis {
  @extend .emphasis;
  color: blue;
}

The preceding SCSS code compiles into the following CSS:

.emphasis, .special-emphasis {
  font-weight: bold;
  background-color: #ffffaa;
  font-size: 1.5em; }

.special-emphasis {
  color: blue; }

Now we can use special-emphasis and it will have all the characteristics of emphasis and the additional property of blue text.

One thing that's beautiful about the @extend directive is that it extends all the occurrences of a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required