Skip to content

Instantly share code, notes, and snippets.

@raulb
Created June 14, 2012 16:59
Show Gist options
  • Save raulb/2931487 to your computer and use it in GitHub Desktop.
Save raulb/2931487 to your computer and use it in GitHub Desktop.
Linear gradient and background image mixed with SASS
// Basic example
@mixin linear-gradient-image($image-url, $start-color, $stop-color)
background: url(#{$image-url}) right 0 no-repeat, $stop-color
background: url(#{$image-url}) right 0 no-repeat, -moz-linear-gradient(top, $start-color, $stop-color)
background: url(#{$image-url}) right 0 no-repeat, -ms-linear-gradient(top, $start-color, $stop-color)
background: url(#{$image-url}) right 0 no-repeat, -o-linear-gradient(top, $start-color, $stop-color)
background: url(#{$image-url}) right 0 no-repeat, -webkit-gradient(linear, left top, left bottom, from($start-color), to($stop-color))
background: url(#{$image-url}) right 0 no-repeat, -webkit-linear-gradient(top, $start-color, $stop-color)
background: url(#{$image-url}) right 0 no-repeat, linear-gradient(top, $start-color, $stop-color)
.foo
+linear-gradient-image("/images/base/buttons/right-select.png", #A8E7FE, #53CBF5)
@raulb
Copy link
Author

raulb commented Jun 30, 2012

@include background(url("/image.png") right 0 no-repeat, linear-gradient(top, #A8E7FE, #53CBF5))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment