snipt

Ctrl+h for KB shortcuts

SCSS

Vertical gradient background, with alpha opacity and IE support. Compass+Sass style.

1
2
3
4
5
6
$color_start: rgba(255,255,255,1);
$color_stop:  rgba(255,255,255,0);
#gradient {
    @include background(filter-gradient(ie-hex-str($color_start), ie-hex-str($color_stop))); // For IE
    @include background(linear-gradient($color_start, $color_stop));
}
https://snipt.net/embed/7cd0787f39a05f476c04ac0400a57c22/
/raw/7cd0787f39a05f476c04ac0400a57c22/
7cd0787f39a05f476c04ac0400a57c22
scss
SCSS
6
2019-06-21T21:08:25
True
False
False
/api/public/snipt/39983/
vertical-gradient-background-with-alpha-opacity-and-ie-support-compasssass-style
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nv">$color_start</span><span class="o">:</span> <span class="nf">rgba</span><span class="p">(</span><span class="mi">255</span><span class="o">,</span><span class="mi">255</span><span class="o">,</span><span class="mi">255</span><span class="o">,</span><span class="mi">1</span><span class="p">);</span> </span><span id="L-2"><a name="L-2"></a><span class="nv">$color_stop</span><span class="o">:</span> <span class="nf">rgba</span><span class="p">(</span><span class="mi">255</span><span class="o">,</span><span class="mi">255</span><span class="o">,</span><span class="mi">255</span><span class="o">,</span><span class="mi">0</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="nn">#gradient</span> <span class="p">{</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">@include</span><span class="nd"> background</span><span class="p">(</span><span class="nf">filter-gradient</span><span class="p">(</span><span class="nf">ie-hex-str</span><span class="p">(</span><span class="nv">$color_start</span><span class="p">)</span><span class="o">,</span> <span class="nf">ie-hex-str</span><span class="p">(</span><span class="nv">$color_stop</span><span class="p">)));</span> <span class="c1">// For IE</span> </span><span id="L-5"><a name="L-5"></a> <span class="k">@include</span><span class="nd"> background</span><span class="p">(</span><span class="nf">linear-gradient</span><span class="p">(</span><span class="nv">$color_start</span><span class="o">,</span> <span class="nv">$color_stop</span><span class="p">));</span> </span><span id="L-6"><a name="L-6"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
background, compass, gradient, sass