Reader small image

You're reading from  Less Web Development Essentials (Second Edition)

Product typeBook
Published inApr 2015
Publisher
ISBN-139781783554072
Edition1st Edition
Tools
Right arrow
Author (1)
Bass Jobsen
Bass Jobsen
author image
Bass Jobsen

Bass Jobsen has been programming the web since 1995, ranging from C to PHP. He has a special interest in the processes between designer and programmer. He works on the accessibility of Bootstrap and his JBST WordPress starters theme. With over 5 years of experience with Bootstrap, Bass has been actively contributing to the community with his blogs and Git repos.
Read more about Bass Jobsen

Right arrow

The box-shadow mixin


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

.box-shadow(@style, @c) when (iscolor(@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 length values describe the vertical and horizontal offsets related to the center of the box. These values are required but can be set to 0 to get an equal-sized shadow around the box. The final values are optional and set the blur radius and the spread radius, respectively. The blur and spread radii are...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Less Web Development Essentials (Second Edition)
Published in: Apr 2015Publisher: ISBN-13: 9781783554072

Author (1)

author image
Bass Jobsen

Bass Jobsen has been programming the web since 1995, ranging from C to PHP. He has a special interest in the processes between designer and programmer. He works on the accessibility of Bootstrap and his JBST WordPress starters theme. With over 5 years of experience with Bootstrap, Bass has been actively contributing to the community with his blogs and Git repos.
Read more about Bass Jobsen