Skip to content

Instantly share code, notes, and snippets.

@iamjohnlong
Created September 10, 2012 18:08
Show Gist options
  • Save iamjohnlong/3692623 to your computer and use it in GitHub Desktop.
Save iamjohnlong/3692623 to your computer and use it in GitHub Desktop.
LESS mixin for background with an image stacked on a gradient
.img-grad(
@color: "#fff",
@bgimg: "..",
@pos: 50% 50%,
@repeat: repeat,
@begin: #fff,
@end: #000,
) {
/* browsers without support for multiple bgs */
background: @color @bgimg @pos @repeat;
/* Webkit - oldest -> newer syntax */
background: @bgimg @pos @repeat, -webkit-gradient(linear, 0 0, 100% 0, from(@begin), to(@end));
background: @bgimg @pos @repeat, -webkit-linear-gradient(top, @begin, @end);
background: @bgimg @pos @repeat, -o-linear-gradient(top, @begin, @end);
background: @bgimg @pos @repeat, -moz-linear-gradient(top, @begin, @end);
background: @bgimg @pos @repeat, linear-gradient(top, @begin, @end);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment