Skip to content

Instantly share code, notes, and snippets.

@mechanicalduck
Created October 14, 2014 23:13
Show Gist options
  • Select an option

  • Save mechanicalduck/c139bfdcc50dadab324a to your computer and use it in GitHub Desktop.

Select an option

Save mechanicalduck/c139bfdcc50dadab324a to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<html>
<head>
<title>Test</title>
</head>
<body>
<div id="test">Test</div>
</body>
</html>
// ----
// Sass (v3.4.5)
// Compass (v1.0.1)
// ----
@import "compass";
@mixin gradient-with-fallback($style, $position, $start, $end) {
// Function name interpolation not possible (yet) in SASS:
$gradient: nil;
@if $style == 'linear' {
$gradient: linear-gradient($position, $start, $end);
} @else if $style == 'radial' {
$gradient: radial-gradient($position, $start, $end);
}
@include background-with-css2-fallback(
image-url('http://www.moosyversum.de/uploads/Fun_Bilder/16x16x16x16x16x16_Farben.png'),
$gradient,
mix($start, $end)
);
};
div#test {
@include gradient-with-fallback(linear, top center, red, blue);
background: url(http://ariya.github.io/svg/tiger.svg) center center no-repeat;
}
html,
body,
div#test
{
width: 100%;
height: 100%;
}
div#test {
background: #7f007f;
background: url(http://www.moosyversum.de/uploads/Fun_Bilder/16x16x16x16x16x16_Farben.png), url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmMDAwMCIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDBmZiIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='), #7f007f;
background: url(http://www.moosyversum.de/uploads/Fun_Bilder/16x16x16x16x16x16_Farben.png), -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ff0000), color-stop(100%, #0000ff)), #7f007f;
background: url(http://www.moosyversum.de/uploads/Fun_Bilder/16x16x16x16x16x16_Farben.png), -moz-linear-gradient(top center, #ff0000, #0000ff), #7f007f;
background: url(http://www.moosyversum.de/uploads/Fun_Bilder/16x16x16x16x16x16_Farben.png), -webkit-linear-gradient(top center, #ff0000, #0000ff), #7f007f;
background: url(http://www.moosyversum.de/uploads/Fun_Bilder/16x16x16x16x16x16_Farben.png), linear-gradient(to bottom center, #ff0000, #0000ff), #7f007f;
background: url(http://ariya.github.io/svg/tiger.svg) center center no-repeat;
}
html,
body,
div#test {
width: 100%;
height: 100%;
}
<html>
<head>
<title>Test</title>
</head>
<body>
<div id="test">Test</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment