This LESS loop mixins generates trendy flat long shadow with any angle for inline text, font icons, block elements and SVGs. Looks best if wrapped by square overflow: hidden;
container with bold padding and rounded corners. Dont forget about good contrast color palette. Enjoy!
- Make shure that you installed client or server-side LESS css-preprocessor
- Clone git repo or Download and copy
long-shadow.less
to your e.g./assets/less
directory - Plug it to project by insert
@import "long-shadow.less";
at beginning of main LESS/CSS stylesheet file - Assign mixins to elements rules.
- PROFIT
.someClass {
#long-shadow.inline(@color, @angle, @size); // For text or icon
#long-shadow.block(@color, @angle, @size, @prefix); // For container
#long-shadow.svg(@color, @angle, @size, @prefix); // For SVG
}
- @color of shadow e.g.
#00FFFF
,@someVariable
ordarken(#00FFFF)
:- Default
#CCCCCC
.
- Default
- @angle of shadow from 0 to 360. Zero meant horizontal shadow with right direction:
- Default
45
.
- Default
- @size that shadow length would be:
- Default
10
.
- Default
- @prefix param define the use of CSS browser-prefixes for
box-shadow
orfilter
rule:0
: false1
: true Default
Be careful with large values of the param
size
with client-side compiling. Using LESS in the browser is great for development, but it's not recommended for production due low performance.
Have a bug or a feature request? Please open a new issue. Before opening any issue, please search for existing issues.
- Correctly implement spread transparency.
- Add support for shadows on SVG.
- Add ability to specify an angle of shadow.
2.1.1
- Fix default color var. Thanx to Sergey Pimenov.
2.1.0
- Add support for shadows on SVG by Randall Bruder.
2.0.0
- INCOMPATIBLE CHANGES! Add namespace and rename mixins.
- Add ability to specify an angle of shadow. Idea Mark Campbell.
- Add option to choose whether to use browser-prefixes.
- Remove spread parameter. Now total flat shadow.
1.0.0
- Initial release.