<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Zeroed and Noughted &#187; CSS</title>
	<atom:link href="http://zeroedandnoughted.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://zeroedandnoughted.com</link>
	<description>0000000000000000000000000000000000</description>
	<lastBuildDate>Fri, 26 Aug 2011 11:12:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Book Giveaway</title>
		<link>http://zeroedandnoughted.com/book-giveaway/</link>
		<comments>http://zeroedandnoughted.com/book-giveaway/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 11:12:02 +0000</pubDate>
		<dc:creator>booshtukka</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://zeroedandnoughted.com/?p=287</guid>
		<description><![CDATA[Techrant are running a giveaway of my book and saying very lovely things about it too. Take a look.]]></description>
			<content:encoded><![CDATA[<p>Techrant are running a <a href="http://techrant.co.uk/2011/08/book-giveaway-pro-css-for-high-traffic-websites/">giveaway of my book</a> and saying very lovely things about it too. Take a look.</p>
]]></content:encoded>
			<wfw:commentRss>http://zeroedandnoughted.com/book-giveaway/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updated High Performance CSS Slides</title>
		<link>http://zeroedandnoughted.com/updated-high-performance-css-slides/</link>
		<comments>http://zeroedandnoughted.com/updated-high-performance-css-slides/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 10:57:33 +0000</pubDate>
		<dc:creator>booshtukka</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://zeroedandnoughted.com/?p=283</guid>
		<description><![CDATA[My recent presentation from Standards Next is now up on SlideShare. View the presentation.]]></description>
			<content:encoded><![CDATA[<p>My recent presentation from <a href="http://standards-next.org/">Standards Next</a> is now up on SlideShare.</p>
<p><a href="http://www.slideshare.net/booshtukka/high-performance-css">View the presentation</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://zeroedandnoughted.com/updated-high-performance-css-slides/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS3 Snippets in TextMate &#8211; Linear Gradients</title>
		<link>http://zeroedandnoughted.com/css3-snippets-in-textmate-linear-gradients/</link>
		<comments>http://zeroedandnoughted.com/css3-snippets-in-textmate-linear-gradients/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 14:22:29 +0000</pubDate>
		<dc:creator>booshtukka</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://zeroedandnoughted.com/?p=261</guid>
		<description><![CDATA[Gradients are great. Linear gradients are super-great, because (as long as you don&#8217;t want funky angles) they work on pretty much all current browsers if you can remember the syntax. I can&#8217;t remember the syntax, but with a little home-schooling TextMate can… Create these 2 snippets within TextMate&#8217;s CSS scope: Name: background: vertical linear gradient [...]]]></description>
			<content:encoded><![CDATA[<p>Gradients are great. Linear gradients are super-great, because (as long as you don&#8217;t want funky angles) they work on pretty much all current browsers if you can remember the syntax. I can&#8217;t remember the syntax, but with a little home-schooling TextMate can…</p>
<p>Create these 2 snippets within TextMate&#8217;s CSS scope:</p>
<p><code class="block"></p>
<dl>
<dt>Name:</dt>
<dd>background: vertical linear gradient</dd>
<dt>Tab trigger:</dt>
<dd>background</dd>
<dt>Scope Selector:</dt>
<dd>source.css</dd>
<dt>Snippet:</dt>
<dd>
<pre class="brush: css; title: ;">background: ${1:top-color};
background: -webkit-gradient(linear, left top, left bottom, from(${1:top-color}), to(${2:bottom-color}));
background: -moz-linear-gradient(top, ${1:top-color}, ${2:bottom-color});
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=${1:top-color}, endColorstr=${2:bottom-color});
-ms-filter: &amp;quot;progid:DXImageTransform.Microsoft.gradient(startColorstr=${1:top-color}, endColorstr=${2:bottom-color})&amp;quot;;
$3</pre>
</dd>
</dl>
<p></code></p>
<p><code class="block"></p>
<dl>
<dt>Name:</dt>
<dd>background: horizontal linear gradient</dd>
<dt>Tab trigger:</dt>
<dd>background</dd>
<dt>Scope Selector:</dt>
<dd>source.css</dd>
<dt>Snippet:</dt>
<dd>
<pre class="brush: css; title: ;">background: ${1:left-color};
background: -webkit-gradient(linear, left top, right top, from(${1:left-color}), to(${2:right-color}));
background: -moz-linear-gradient(left top, ${1:left-color}, ${2:right-color});
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=${1:left-color}, endColorstr=${2:right-color}, GradientType=1);
-ms-filter: &amp;quot;progid:DXImageTransform.Microsoft.gradient(startColorstr=${1:left-color}, endColorstr=${2:right-color}, GradientType=1)&amp;quot;;
$3</pre>
</dd>
</dl>
<p></code></p>
<p>Now, typing <code>background</code> within a CSS context and pressing <kbd>tab</kbd> should show something like this:</p>
<p><img style="display:block; margin-left:auto; margin-right:auto;" src="http://zeroedandnoughted.com/wp-content/uploads/2010/08/background.jpg" alt="background.jpg" border="0" width="516" height="334" /></p>
<p>Choosing one of the two new options at the bottom will give you all the code you need for most browsers to show a horizontal or vertical linear gradient. The first colour you enter (either the top-most or left-most colour) will become the default background for browsers that don&#8217;t support gradients, which is hopefully usually what you want. In case you were wondering, <code>-ms-filter</code> is specifically for IE8 (in IE8-mode) which requires quotes around the contents.</p>
]]></content:encoded>
			<wfw:commentRss>http://zeroedandnoughted.com/css3-snippets-in-textmate-linear-gradients/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CSS3 Snippets in TextMate &#8211; box-shadow</title>
		<link>http://zeroedandnoughted.com/css3-snippets-in-textmate-box-shadow/</link>
		<comments>http://zeroedandnoughted.com/css3-snippets-in-textmate-box-shadow/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 12:25:57 +0000</pubDate>
		<dc:creator>booshtukka</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[TextMate]]></category>

		<guid isPermaLink="false">http://www.zeroedandnoughted.com/?p=221</guid>
		<description><![CDATA[As promised, the next in the series – box-shadow. Create this snippets within CSS: Name: box-shadow Tab trigger: box-shadow Snippet: -moz-box-shadow: ${1:hOffset} ${2:vOffset} ${3:blurRadius} ${4:color}; -webkit-box-shadow: ${1:hOffset} ${2:vOffset} ${3:blurRadius} ${4:color}; box-shadow: ${1:hOffset} ${2:vOffset} ${3:blurRadius} ${4:color}; $0 More to come. Any requests?]]></description>
			<content:encoded><![CDATA[<p>As promised, the next in the series – <code>box-shadow</code>.</p>
<p>Create this snippets within CSS:</p>
<p><code class="block"></p>
<dl>
<dt>Name:</dt>
<dd>box-shadow</dd>
<dt>Tab trigger:</dt>
<dd>box-shadow</dd>
<dt>Snippet:</dt>
<dd>
<pre class="brush: css; title: ;">-moz-box-shadow: ${1:hOffset} ${2:vOffset} ${3:blurRadius} ${4:color};
-webkit-box-shadow: ${1:hOffset} ${2:vOffset} ${3:blurRadius} ${4:color};
box-shadow: ${1:hOffset} ${2:vOffset} ${3:blurRadius} ${4:color};
$0</pre>
</dd>
</dl>
<p></code></p>
<p>More to come. Any requests?</p>
]]></content:encoded>
			<wfw:commentRss>http://zeroedandnoughted.com/css3-snippets-in-textmate-box-shadow/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Bookmarklet to de-cache CSS and images &#8211; Version 2</title>
		<link>http://zeroedandnoughted.com/bookmarklet-to-de-cache-css-and-images-version-2/</link>
		<comments>http://zeroedandnoughted.com/bookmarklet-to-de-cache-css-and-images-version-2/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 23:34:37 +0000</pubDate>
		<dc:creator>booshtukka</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://zeroedandnoughted.com/?p=41</guid>
		<description><![CDATA[You may recall, in this previous post I showed you how to use a bookmarklet (typically a small piece of JavaScript you can save as a bookmark and run against a page) to get the latest versions of CSS files and images, and not use the cached files. The previous version had some limitations. Namely: [...]]]></description>
			<content:encoded><![CDATA[<p>You may recall, in <a href="http://zeroedandnoughted.com/2008/05/29/bookmarklet-to-de-cache-css-and-images/">this previous post</a> I showed you how to use a bookmarklet (typically a small piece of JavaScript you can save as a bookmark and run against a page) to get the latest versions of <acronym title="Cascading StyleSheets">CSS</acronym> files and images, and not use the cached files. The previous version had some limitations. Namely:</p>
<ul>
<li>Background images set in <acronym title="Cascading StyleSheets">CSS</acronym> would not be refreshed</li>
<li>Frame and iframe contents would not be refreshed</li>
<li>In some instances it was one-hit only &#8211; i.e.  you could only run it once, without having to manually refresh the page anyway</li>
</ul>
<p>So, I would like to present to you &#8211; CacheBuster version 2. Or CacheBusterizer the second. Or MegaCacheKiller 2. You get the idea.</p>
<p>This time, I will step through the code and how it works.</p>
<p>Getting the current values of styles set via <acronym title="Cascading StyleSheets">CSS</acronym> can be a pain. Unless they were explicitly set via JavaScript, we can only fetch them using <code>currentStyle</code> or <code>getComputedStyle</code>, complete of course with their own browser idiosyncrasies. Therefore, the first thing we need is a function to do this for us in a cross-browser fashion. I have amended a version I found on <a href="http://blog.stchur.com/2006/06/21/css-computed-style/">Incoherent Babble.</a></p>
<pre class="brush: jscript; title: ;">function gcs(e,s) {
	if (typeof e.currentStyle != 'undefined') {
		return e.currentStyle[s];
	} else {
		return document.defaultView.getComputedStyle(e, null)[s];
	}
}</pre>
<p>In this instance, <code>e</code> represents the element, and <code>s</code> is a string representing the style we are looking for. Remember that we are looking JavaScript termed styles, not <acronym title="Cascading StyleSheets">CSS</acronym> &#8211; so <code>backgroundImage</code>, rather than <code>background-image</code>.</p>
<p>Since I am going to loop through all of the frames in the page, as well as the main window itself, I have decided to join these together in a single array, rather than writing the code out twice.</p>
<pre class="brush: jscript; title: ;">var z =[];
z.push(self);
z.concat(self.frames);</pre>
<p>To get the latest version of the files, I will just amend a querystring with the current time on the end of the filename.</p>
<pre class="brush: jscript; title: ;">var y = new Date().getTime();</pre>
<p>And finally, we do the work:</p>
<pre class="brush: jscript; title: ;">for (k=0,l=z.length;k&lt;l;k++) {
	x=z[k].document.getElementsByTagName('*');
	for (i=0,j=x.length;i&lt;j;i++){
		bi = gcs(x[i],'backgroundImage');
		if (bi.indexOf(')') &gt; -1){
			bi = bi.replace(/'/gi,'').replace(/&quot;/gi,'');
			x[i].style.backgroundImage=bi.replace(')',(bi.indexOf('?')==-1?'?':'')+y+')');
		}
	}
	x=z[k].document.getElementsByTagName('link');
	for(i=0,j=x.length;i&lt;j;i++){
		x[i].href+=(x[i].href.indexOf('?')==-1?'?':'')+y;
	}
	x=z[k].document.getElementsByTagName('img');
	for(i=0,j=x.length;i&lt;j;i++){
		x[i].src+=(x[i].src.indexOf('?')==-1?'?':'')+y;
	}
}</pre>
<p>This code:</p>
<ul>
<li>Loops through all elements on the page, checks to see if they have a background image set and appends the time on the end of the <acronym title="Universal Resource Identifier">URI</acronym> if they do</li>
<li>Loops through all the <code>link</code> tags on a page for stylesheets, and appends the time on the end of the <code>href</code> of any it finds</li>
<li>Loops through all the <code>img</code> tags on a page, and appends the time on the end of the <code>src</code> of any it finds</li>
</ul>
<p>Finally, we wrap the whole lot in a closure to make sure we don&#8217;t mess with the main <code>window</code> namespace, tidy up, and we get:</p>
<pre class="brush: jscript; title: ;">(function(){
	var gcs = function(e,s) {
	  if (typeof e.currentStyle != 'undefined')
	    { return e.currentStyle[s]; }
	  else
	    { return document.defaultView.getComputedStyle(e, null)[s]; }
	};
	var i,j,k,l,x,y,z,bi;
	z =[];
	z.push(self);
	z.concat(self.frames);
	y = new Date().getTime();
	for (k=0,l=z.length;k&lt;l;k++) {
		x=z[k].document.getElementsByTagName('*');
		for (i=0,j=x.length;i&lt;j;i++){
			bi = gcs(x[i],'backgroundImage');
			if (bi.indexOf(')') &gt; -1){
				bi = bi.replace(/'/gi,'').replace(/&quot;/gi,'');
				x[i].style.backgroundImage=bi.replace(')',(bi.indexOf('?')==-1?'?':'')+y+')');
			};
		};
		x=z[k].document.getElementsByTagName('link');
		for(i=0,j=x.length;i&lt;j;i++){
			x[i].href+=(x[i].href.indexOf('?')==-1?'?':'')+y;
		};
		x=z[k].document.getElementsByTagName('img');
		for(i=0,j=x.length;i&lt;j;i++){
			x[i].src+=(x[i].src.indexOf('?')==-1?'?':'')+y;
		};
	};
})();
</pre>
<p>The last thing to do, is stick it all on one line, and prefix <code>javascript:</code> and we&#8217;re done.</p>
<pre class="brush: jscript; title: ;">javascript:(function(){var gcs=function(e,s){if(typeof e.currentStyle!='undefined'){return e.currentStyle[s];}else{return document.defaultView.getComputedStyle(e,null)[s];}};var i,j,k,l,x,y,z,bi;z=[];z.push(self);z.concat(self.frames);y=new Date().getTime();for(k=0,l=z.length;k&lt;l;k++){x=z[k].document.getElementsByTagName('*');for(i=0,j=x.length;i&lt;j;i++){bi=gcs(x[i],'backgroundImage');if(bi.indexOf(')')&gt;-1){bi=bi.replace(/'/gi,'').replace(/&quot;/gi,'');x[i].style.backgroundImage=bi.replace(')',(bi.indexOf('?')==-1?'?':'')+y+')');}};x=z[k].document.getElementsByTagName('link');for(i=0,j=x.length;i&lt;j;i++){x[i].href+=(x[i].href.indexOf('?')==-1?'?':'')+y;};x=z[k].document.getElementsByTagName('img');for(i=0,j=x.length;i&lt;j;i++){x[i].src+=(x[i].src.indexOf('?')==-1?'?':'')+y;};};})();</pre>
<p>Save this result as a bookmark, and any page you run the bookmark against will load all images and <acronym title="Cascading StyleSheets">CSS</acronym> anew, bypassing the cache! Phew.</p>
<p>The only remaining caveat I can think of: this won&#8217;t work for <acronym title="Cascading StyleSheets">CSS</acronym> included with the <code>@import</code> directive. Any ideas?</p>
<p>Comments, as always, are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://zeroedandnoughted.com/bookmarklet-to-de-cache-css-and-images-version-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS to Change Highlighted Text Style in Mozilla</title>
		<link>http://zeroedandnoughted.com/css-to-change-highlighted-text-style-in-mozilla/</link>
		<comments>http://zeroedandnoughted.com/css-to-change-highlighted-text-style-in-mozilla/#comments</comments>
		<pubDate>Fri, 09 May 2008 13:44:16 +0000</pubDate>
		<dc:creator>booshtukka</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://zeroedandnoughted.wordpress.com/?p=4</guid>
		<description><![CDATA[moz-selection! e.g.: *::-moz-selection { background:#FF2E1D none repeat scroll 0%; color:#FFFFFF; } Working example: http://www.uniqlo.co.uk/stores]]></description>
			<content:encoded><![CDATA[<p>moz-selection!</p>
<p>e.g.:</p>
<p>*::-moz-selection {<br />
	background:#FF2E1D none repeat scroll 0%;<br />
	color:#FFFFFF;<br />
}</p>
<p>Working example:</p>
<p><a href="http://www.uniqlo.co.uk/stores">http://www.uniqlo.co.uk/stores</a></p>
]]></content:encoded>
			<wfw:commentRss>http://zeroedandnoughted.com/css-to-change-highlighted-text-style-in-mozilla/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

