Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

CSS

Color Selection in CSS

1
2
3
4
5
6
::selection {
	background: #E599FF; /* Safari */
	}
::-moz-selection {
	background: #E599FF; /* Firefox */
}
https://snipt.net/embed/dcee528b0dc0c8ece91b5e8777402449/
https://snipt.net/raw/dcee528b0dc0c8ece91b5e8777402449/
dcee528b0dc0c8ece91b5e8777402449
css
CSS
6
2016-12-02T13:42:16
True
False
False
Aug 29, 2013 at 07:06 AM
/api/public/snipt/77777/
color-selection-in-css
<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="o">:</span><span class="nd">:selection</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="nb">background</span><span class="o">:</span> <span class="m">#E599FF</span><span class="p">;</span> <span class="c">/* Safari */</span> </span><span id="L-3"><a name="L-3"></a> <span class="p">}</span> </span><span id="L-4"><a name="L-4"></a><span class="o">:</span><span class="nd">:-moz-selection</span> <span class="p">{</span> </span><span id="L-5"><a name="L-5"></a> <span class="nb">background</span><span class="o">:</span> <span class="m">#E599FF</span><span class="p">;</span> <span class="c">/* Firefox */</span> </span><span id="L-6"><a name="L-6"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
css, selection

JavaScript

checking selection

1
2
3
4
5
$(document).ready(function() {
alert($('#celebs tbody tr').length + ' elements!');
});

//without tbody it selects also the table header, thus returning an incorrect number of elements
https://snipt.net/embed/d2bc5888bdde73909d441ae5f7c89e98/
https://snipt.net/raw/d2bc5888bdde73909d441ae5f7c89e98/
d2bc5888bdde73909d441ae5f7c89e98
js
JavaScript
5
2016-12-04T18:47:22
True
False
False
/api/public/snipt/17744/
checking-selection
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">(</span><span class="nb">document</span><span class="p">).</span><span class="nx">ready</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a><span class="nx">alert</span><span class="p">(</span><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;#celebs tbody tr&#39;</span><span class="p">).</span><span class="nx">length</span> <span class="o">+</span> <span class="s1">&#39; elements!&#39;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="p">});</span> </span><span id="L-4"><a name="L-4"></a> </span><span id="L-5"><a name="L-5"></a><span class="c1">//without tbody it selects also the table header, thus returning an incorrect number of elements</span> </span></pre></div> </td></tr></table>
jquery, selection

CSS

Selection color

1
2
3
4
5
6
7
8
::selection {
	background: red; /* Safari */
	color: #333;
	}
::-moz-selection {
	background: red; /* Firefox */
	color: #333;
}
https://snipt.net/embed/7fe97c9cc545ca46d60e953acf19afe1/
https://snipt.net/raw/7fe97c9cc545ca46d60e953acf19afe1/
7fe97c9cc545ca46d60e953acf19afe1
css
CSS
8
2016-12-02T09:07:13
True
False
False
/api/public/snipt/10545/
selection-color
<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> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="o">:</span><span class="nd">:selection</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="nb">background</span><span class="o">:</span> <span class="nb">red</span><span class="p">;</span> <span class="c">/* Safari */</span> </span><span id="L-3"><a name="L-3"></a> <span class="nb">color</span><span class="o">:</span> <span class="m">#333</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a> <span class="p">}</span> </span><span id="L-5"><a name="L-5"></a><span class="o">:</span><span class="nd">:-moz-selection</span> <span class="p">{</span> </span><span id="L-6"><a name="L-6"></a> <span class="nb">background</span><span class="o">:</span> <span class="nb">red</span><span class="p">;</span> <span class="c">/* Firefox */</span> </span><span id="L-7"><a name="L-7"></a> <span class="nb">color</span><span class="o">:</span> <span class="m">#333</span><span class="p">;</span> </span><span id="L-8"><a name="L-8"></a><span class="p">}</span> </span></pre></div> </td></tr></table>
selection, text
Copyrighted, illegal, or inappropriate content? Email [email protected].