O'Reilly logo

Less Web Development Essentials by Bass Jobsen

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

The box-shadow mixin

With all that you have learned about Less, you now can understand, build, and evaluate any complex Less code. To prove this, please open less/mixins.less and take a look at the box-shadow mixin (originally published on lesscss.org), which looks like the following code:

.box-shadow(@style, @c) when (iscolor(@c)) {
  -webkit-box-shadow: @style @c;
  -moz-box-shadow:    @style @c;
  box-shadow:         @style @c;
}
.box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) {
  .box-shadow(@style, rgba(0, 0, 0, @alpha));
}

To fully understand these mixins, you will have to know the basics of box-shadow in CSS3. The box-shadow properties accept a CSV list of shadows. A shadow consists of a list of two to four length values and a color. The first two ...

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