<?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>Milburn &#187; CSS</title>
	<atom:link href="http://instantsolve.net/blog/category/webdesign/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://instantsolve.net/blog</link>
	<description>The Life and Work of Thomas Milburn</description>
	<lastBuildDate>Wed, 14 Oct 2009 10:58:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Javascript Anaglyph Maker</title>
		<link>http://instantsolve.net/blog/2009/04/javascript-anaglyph-maker/</link>
		<comments>http://instantsolve.net/blog/2009/04/javascript-anaglyph-maker/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 14:56:55 +0000</pubDate>
		<dc:creator>milburn</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://instantsolve.net/blog/?p=144</guid>
		<description><![CDATA[My own anaglyph maker uses PHP to make anaglyphs from two images uploaded by a user. But I&#8217;ve found someone who has gone one step further. They&#8217;ve managed to make them using JavaScript alone. Unfortunately Internet Explorer fails miserably on this task. This is because his method uses the canvas object which so far is [...]]]></description>
			<content:encoded><![CDATA[<p class="first-child "><img src="http://instantsolve.net/blog/wp-content/uploads/2009/04/mars-300x225.png" alt="mars" title="mars" width="300" height="225" class="alignright size-medium wp-image-152" /> <span title="M" class="cap"><span>M</span></span>y own <a href="http://instantsolve.net/anaglyph/">anaglyph maker</a> uses PHP to make anaglyphs from two images uploaded by a user. But I&#8217;ve found someone who has gone one step further. They&#8217;ve managed to make them <a href="http://svay.com/blog/index/post/2009/04/03/G%C3%A9n%C3%A9rer-des-anaglyphes-avec-javascript-et-canvas">using JavaScript alone</a>. Unfortunately Internet Explorer fails miserably on this task. This is because his method uses the canvas object which so far is only supported by Firefox, Safari and Opera.</p>
<p>It simply loads the two images into two canvas elements and extracts the red channel from one of them and inserts that red channel into the other canvas. Hey presto you get a simple anaglyph. This method has another flaw. Modifying an images data channels can only be done from an image on the same domain to obey the same domain security policy. A small proxy sorts that out but means the solution isn&#8217;t all JavaScript.<span id="more-144"></span></p>
<p>Here&#8217;s the source code for his anaglyph generator:</p>
<p><code>&lt;<span class="start-tag">script</span><span class="attribute-name"> type</span>=<span class="attribute-value">"text/javascript"</span>&gt;<br />
&lt;!--<br />
Anaglyph = {<br />
imgLeft : null,<br />
imgRigt : null,<br />
//Load images<br />
load : function(left, right) {<br />
//console.log('Load');<br />
Anaglyph.imgLeft = document.createElement('img');<br />
Anaglyph.imgLeft.src = left;<br />
Anaglyph.imgRight = document.createElement('img');<br />
Anaglyph.imgRight.src = right;<br />
Anaglyph.wait();<br />
},<br />
//Wait for images to load<br />
wait: function() {<br />
if (Anaglyph.imgLeft.complete &amp;&amp; Anaglyph.imgRight.complete) {<br />
Anaglyph.make();<br />
} else {<br />
setTimeout('Anaglyph.wait()', 100);<br />
}<br />
},<br />
//Actually make the anaglyph with some canvas magic<br />
make: function() {<br />
//console.log('Make');<br />
var w = 640;<br />
var h = 480;<br />
var canvas = document.getElementsByTagName('canvas')[0];<br />
try {<br />
//Left image in temporary canvas<br />
var canvasLeft = document.createElement('canvas');<br />
canvasLeft.width = w;<br />
canvasLeft.height = h;<br />
var ctxLeft = canvasLeft.getContext('2d');<br />
ctxLeft.drawImage(Anaglyph.imgLeft, 0, 0, w, h);<br />
var dataLeft = ctxLeft.getImageData(0,0, w, h);<br />
//Right image in result canvas<br />
canvas.width = w;<br />
canvas.height = h;<br />
var ctx = canvas.getContext('2d');<br />
ctx.drawImage(Anaglyph.imgRight, 0, 0, w, h);<br />
var data = ctx.getImageData(0,0, w, h);<br />
for (var i=0,l=dataLeft.data.length/4; i&lt;l; i++) {<br />
data.data[i * 4 + 0] = dataLeft.data[i * 4 + 0];<br />
}<br />
ctx.putImageData(data, 0, 0);<br />
//console.log('Done!');<br />
} catch (e) {<br />
//console.log('FAIL!')<br />
}<br />
document.getElementById('result').className = '';<br />
}<br />
}<br />
function getQueryParameter(name) {<br />
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");<br />
var regexS = "[\\?&amp;]"+name+"=([^&amp;#]*)";<br />
var regex = new RegExp( regexS );<br />
var results = regex.exec( window.location.href );<br />
if( results == null ) {<br />
return "";<br />
} else {<br />
return results[1];<br />
}<br />
}<br />
window.onload = function() {<br />
if ('' != getQueryParameter('left') &amp;&amp; '' != getQueryParameter('right')) {<br />
var left = getQueryParameter('left');<br />
var right = getQueryParameter('right');<br />
document.getElementById('result').className = 'loading';<br />
Anaglyph.load(<br />
'image.php?url='+left,<br />
'image.php?url='+right<br />
);<br />
}<br />
}<br />
--&gt;<br />
&lt;/<span class="end-tag">script</span>&gt;</code></p>
<p>The canvas element can do so many things and my guess is we&#8217;ll be seeing it even more in the next few years.</p>
]]></content:encoded>
			<wfw:commentRss>http://instantsolve.net/blog/2009/04/javascript-anaglyph-maker/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Instant Star Rating</title>
		<link>http://instantsolve.net/blog/2009/02/instant-star-rating/</link>
		<comments>http://instantsolve.net/blog/2009/02/instant-star-rating/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 18:11:22 +0000</pubDate>
		<dc:creator>milburn</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://instantsolve.net/blog/?p=129</guid>
		<description><![CDATA[Released earlier this week was my star rating tool. I&#8217;d actually started this about a year ago but only remembered last weekend that I had it gathering dust in my hard drive. Instant Star Rating allows you to create 5 star ratings in several different styles to go on your website. Unlike other star raters [...]]]></description>
			<content:encoded><![CDATA[<p class="first-child "><span title="R" class="cap"><span>R</span></span>eleased earlier this week was my <a href="http://instantsolve.net/rating/">star rating tool</a>. I&#8217;d actually started this about a year ago but only remembered last weekend that I had it gathering dust in my hard drive.</p>
<p>Instant Star Rating allows you to create 5 star ratings in several different styles to go on your website. Unlike other star raters it doesn&#8217;t use Ajax. This is because Ajax doesn&#8217;t work across domains. Instead it uses the dynamic script method. When the user clicks on a star it loads a new script from the server.<span id="more-129"></span></p>
<p>The tool actually gave me some grief since I checked it worked in Firefox and failed to check in IE presuming that it would work in IE too. This was not to be, the rating javascript failed in IE due to an obscure DOM issue. IE doesn&#8217;t support innerHTML on style elements. So I tried to look for an alternative. IE has a property called styleSheet which isn&#8217;t supported by other browsers. CSS can be written to this using the cssText method. An interesting find!</p>
<p>I therefore used the following method to add dynamic CSS:</p>
<p><code>IR1_h=document.getElementsByTagName("head")[0]<br />
IR1_l=document.createElement("style")<br />
IR1_l.type='text/css'<br />
IR1_h.appendChild(IR1_l)<br />
if(IR1_l.styleSheet){<br />
	IR1_l.styleSheet.cssText='#rate1{padding:10px 0}'<br />
}else{<br />
	IR1_l.innerHTML='#rate1{padding:10px 0}'<br />
}<br />
</code></p>
<p>Please try out <a href="http://instantsolve.net/rating/">instant star rating</a>, it is completely free and should work on almost any website. Check out the example below:</p>
<p><script src="http://instantsolve.net/rating/rating.php?id=10"></script> </p>
]]></content:encoded>
			<wfw:commentRss>http://instantsolve.net/blog/2009/02/instant-star-rating/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drop Caps Plugin</title>
		<link>http://instantsolve.net/blog/2008/05/drop-caps-plugin/</link>
		<comments>http://instantsolve.net/blog/2008/05/drop-caps-plugin/#comments</comments>
		<pubDate>Wed, 28 May 2008 16:26:22 +0000</pubDate>
		<dc:creator>milburn</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://instantsolve.net/blog/?p=23</guid>
		<description><![CDATA[Last time, I was showing you how to create the cool drop caps on my blog. The only problem was that I was having to write extra mark-up into each post to generate the drop caps. Extra mark-up is bad. It&#8217;s bad because if I wanted to change blogging platforms or even change theme I [...]]]></description>
			<content:encoded><![CDATA[<p class="first-child "><span title="L" class="cap"><span>L</span></span>ast time, I was showing you how to create the cool drop caps on my blog. The only problem was that I was having to write extra mark-up into each post to generate the drop caps.</p>
<p>Extra mark-up is bad. It&#8217;s bad because if I wanted to change blogging platforms or even change theme I would have to go through every post and page and remove the HTML mark-up. Not really too difficult with only 4 posts to date but if I have a hundred or so posts in the future, it becomes a real pain.<span id="more-23"></span></p>
<p>The perfect solution would be to incorporate the mark-up in my WordPress template. Unfortunately I can&#8217;t do that because WordPress uses a template tag called the_content(), this only accepts a few variables to modify the &#8220;Read more&#8230;&#8221; link. I needed to come up with a better solution. A fairly simple solution would be to hack about with some other functions to create a modified the_content() template tag.</p>
<p>While this is a much better solution I don&#8217;t really like hacking the WordPress functions. Instead I decided to build a plugin. It sounds like rather a lot of work for applying a tiny bit of styling but it enables me to create an admin page where I can turn the drop caps on and off at the click of a button. Not only that but I can offer this wonderful plugin to the rest of the world using WordPress to create wicked drop caps.</p>
<p>My thanks go to the brilliant <a title="Visit Ronald Huereca's website" rel="external" href="http://www.ronalfy.com/">Ronald Huereca</a> who wrote devlounges &#8220;<a href="http://www.devlounge.net/extras/how-to-write-a-wordpress-plugin">How to write a WordPress plugin</a>&#8220;. I used his code along with taking a peek at some other plugins.</p>
<p>I decided that while I was at it I would fix another issue with my blog theme. I use a first-child selector to choose the first paragraph of each post and make it bold. This breaks in several ways, firstly IE6 doesn&#8217;t support the selector and secondly The first paragraph is sometimes not a paragraph of text. It might be an image. To counter this my plugin also marks the first paragraph starting with a capital with a &#8220;first-child&#8221; class which I can use in my stylesheet.</p>
<p>My plugin can be downloaded from <a href="http://instantsolve.net/blog/plugins/">my plugins page</a> and from the <a href="http://wordpress.org/extend/plugins/drop-caps/">WordPress Plugin Directory</a> Of course for those who don&#8217;t want to write their own CSS like me the plugin automatically adds it&#8217;s own stylesheet to your page.</p>
]]></content:encoded>
			<wfw:commentRss>http://instantsolve.net/blog/2008/05/drop-caps-plugin/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Drop Caps with Drop Shadows</title>
		<link>http://instantsolve.net/blog/2008/05/drop-caps/</link>
		<comments>http://instantsolve.net/blog/2008/05/drop-caps/#comments</comments>
		<pubDate>Mon, 26 May 2008 10:51:55 +0000</pubDate>
		<dc:creator>milburn</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://instantsolve.net/blog/?p=20</guid>
		<description><![CDATA[It&#8217;s one of the most striking features of my blog, the crazy drop capitals with drop shadows. Not only that but I&#8217;ve come up with away to achieve this in all good browsers (unfortunately that doesn&#8217;t include IE) using only CSS and HTML. Let&#8217;s start with the markup. &#60;strong class="cap" title="I" &#62;&#60;span&#62;I&#60;/span&#62;&#60;/strong&#62; Firstly I&#8217;ve created [...]]]></description>
			<content:encoded><![CDATA[<p class="first-child "><span title="I" class="cap"><span>I</span></span>t&#8217;s one of the most striking features of my blog, the crazy drop capitals with drop shadows. Not only that but I&#8217;ve come up with away to achieve this in all good browsers (unfortunately that doesn&#8217;t include IE) using only CSS and HTML. Let&#8217;s start with the markup.</p>
<p><span id="more-20"></span><code>&lt;strong class="cap" title="I" &gt;&lt;span&gt;I&lt;/span&gt;&lt;/strong&gt;</code></p>
<p>Firstly I&#8217;ve created a &#8220;strong&#8221; element with a nested unsemantic &#8220;span&#8221; inside which contains our capital letter. The &#8220;strong&#8221; element has both a title and a class attribute, the title attribute is the important one because we can use it later to generate the shadow text.</p>
<p>To create a large capital we use:</p>
<p><code>strong.cap {<br />
float:left;<br />
color:#F00;<br />
font-family:"Bookman Oldstyle",urwbookmanl,georgia,serif;<br />
font-size:300%;<br />
font-weight:bold;<br />
line-height:1em;<br />
margin-bottom:-0.4em;<br />
position:relative;<br />
}</code></p>
<p>This creates a bog standard drop cap by floating the letter left and making it bigger than the surrounding text. An adjusted bottom margin makes sure the text below wraps correctly.</p>
<p><code>strong.cap span{<br />
display:block;<br />
height:0pt;<br />
position:relative;<br />
right:0.06em;<br />
top:-1.06em;<br />
}<br />
strong.cap:before{<br />
content:attr(title);<br />
color:#333;<br />
}</code></p>
<p>The before pseudo-class is used to generate text in modern browsers (except IE) This creates a letter before the span. Finally we need to overlay the two letters. We do this by making the span display as a block level element which pushes it onto a new line, the line-height has been set to 1em so we can push the span back over the generated letter by positioning it relatively up 1.06em and to the left 0.06em. The additional 0.06em creates a slight offset making it look like a drop shadow. Take a look at the <a href="http://instantsolve.net/blog/wp-content/uploads/2008/05/drop-cap-demo.htm">demo</a>.</p>
<p>Unfortunately IE doesn&#8217;t like it at all and so you need to put the CSS in a non-IE stylesheet. Just stick the CSS in a stylesheet called noie.css and put the following code in your existing stylesheet.</p>
<p><code>@import 'noie.css' screen;</code></p>
<p>Internet Explorer doesn&#8217;t like the media deceleration &#8216;screen&#8217; and so doesn&#8217;t read the rule. Why not experiment with your own fonts and colours and see what you can come up with.</p>
]]></content:encoded>
			<wfw:commentRss>http://instantsolve.net/blog/2008/05/drop-caps/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Flickr Photos on WordPress</title>
		<link>http://instantsolve.net/blog/2008/05/using-flickr-on-wordpress/</link>
		<comments>http://instantsolve.net/blog/2008/05/using-flickr-on-wordpress/#comments</comments>
		<pubDate>Sun, 25 May 2008 20:11:32 +0000</pubDate>
		<dc:creator>milburn</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://instantsolve.net/blog/?p=17</guid>
		<description><![CDATA[I&#8217;ve got a new blog so I need a way to display some cool images at the bottom of the page. Anyone who has dealt with WordPress before will tell you it&#8217;s not made for dealing with images. I&#8217;ve decided to counter my fears and sign up to Flickr. Flickr offers a range of ways [...]]]></description>
			<content:encoded><![CDATA[<p class="first-child "><span title="I" class="cap"><span>I</span></span>&#8217;ve got a new blog so I need a way to display some cool images at the bottom of the page. Anyone who has dealt with WordPress before will tell you it&#8217;s not made for dealing with images. I&#8217;ve decided to counter my fears and sign up to Flickr.</p>
<p><a title="Flickr" href="http://www.flickr.com">Flickr</a> offers a range of ways for developers to integrate images with their website. I have mashed my Flickr photostream with my blog and got a wall of images at the bottom of the page. It was actually remarkably painless to set up, Flickr helps simplify the uploading, classifying and exporting of images.<span id="more-17"></span></p>
<p>I&#8217;ll give you a little tutorial of how I acheived the photo wall at the bottom of my blog.</p>
<ol>
<li>Find the pictures you want and upload them to Flickr.</li>
<li>Organise your pictures, give them meaningful descriptions tags and put them into sets.</li>
<li>To make a simple HTML <em>Flickr Badge</em> you need to go to the following url and follow the steps <a title="Badge maker" href="http://www.flickr.com/badge.gne">http://www.flickr.com/badge.gne</a></li>
<li>Choose the content you want which can be either one of your sets or all your photos.</li>
<li>Choose the layout options but click select orientation to &#8220;none&#8221;</li>
<li>Don&#8217;t worry about picking colours we will style it with our own later.</li>
<li>You will get some code generated which looks like this<code>&lt;style type="text/css"&gt;<br />
#flickr_badge_source_txt {padding:0; font: 11px Arial, Helvetica, Sans serif; color:#666666;}<br />
#flickr_badge_icon {display:block !important; margin:0 !important; border: 1px solid rgb(0, 0, 0) !important;}<br />
#flickr_icon_td {padding:0 5px 0 0 !important;}<br />
.flickr_badge_image {text-align:center !important;}<br />
.flickr_badge_image img {border: 1px solid black !important;}<br />
#flickr_badge_uber_wrapper {width:150px;}<br />
#flickr_www {display:block; text-align:center; padding:0 10px 0 10px !important; font: 11px Arial, Helvetica, Sans serif !important; color:#3993ff !important;}<br />
#flickr_badge_uber_wrapper a:hover,<br />
#flickr_badge_uber_wrapper a:link,<br />
#flickr_badge_uber_wrapper a:active,<br />
#flickr_badge_uber_wrapper a:visited {text-decoration:none !important; background:inherit !important;color:#3993ff;}<br />
#flickr_badge_wrapper {background-color:#ffffff;border: solid 1px #000000}<br />
#flickr_badge_source {padding:0 !important; font: 11px Arial, Helvetica, Sans serif !important; color:#666666 !important;}<br />
&lt;/style&gt;<br />
&lt;table id="flickr_badge_uber_wrapper" cellpadding="0" cellspacing="10" border="0"&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://www.flickr.com" id="flickr_www"&gt;www.&lt;strong style="color:#3993ff"&gt;flick&lt;span style="color:#ff1c92"&gt;r&lt;/span&gt;&lt;/strong&gt;.com&lt;/a&gt;&lt;table cellpadding="0" cellspacing="10" border="0" id="flickr_badge_wrapper"&gt;<br />
&lt;script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?show_name=1&amp;count=3&amp;display=latest&amp;size=t&amp;layout=v&amp;source=user_set&amp;user=26963457%40N02&amp;set=72157605251403235&amp;context=in%2Fset-72157605251403235%2F"&gt;&lt;/script&gt;<br />
&lt;tr&gt;<br />
&lt;td id="flickr_badge_source" valign="center" align="center"&gt;<br />
&lt;table cellpadding="0" cellspacing="0" border="0"&gt;&lt;tr&gt;<br />
&lt;td width="10" id="flickr_icon_td"&gt;&lt;a href="http://www.flickr.com/photos/26963457@N02/sets/72157605251403235/"&gt;&lt;img id="flickr_badge_icon" alt="tomontoast's Germany 2007 photoset" src="http://l.yimg.com/www.flickr.com/images/buddyicon.jpg#26963457@N02" align="left" width="48" height="48"&gt;&lt;/a&gt;&lt;/td&gt;<br />
&lt;td id="flickr_badge_source_txt"&gt;tomontoast's &lt;a href="http://www.flickr.com/photos/26963457@N02/sets/72157605251403235/"&gt;Germany 2007&lt;/a&gt; photoset&lt;/td&gt;<br />
&lt;/tr&gt;&lt;/table&gt;<br />
&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;/table&gt;<br />
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;<br />
&lt;!-- End of Flickr Badge --&gt;</code></li>
<li>Get rid of all the HTML and CSS fluff until you get down to the meat which makes this work:<code>&lt;script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?show_name=1&amp;count=3&amp;display=latest&amp;size=t&amp;layout=v&amp;source=user_set&amp;user=26963457%40N02&amp;set=72157605251403235&amp;context=in%2Fset-72157605251403235%2F"&gt;&lt;/script&gt;</code></li>
<li>Put that tag wherever you want your images to appear. This bit of JavaScript creates a set of divs each with <span class="nodeLabelBox repTarget"><span class="nodeAttr editGroup"><span class="nodeName editable">class</span>=&#8221;<span class="nodeValue editable">flickr_badge_image</span>&#8221; inside each div is an image nested in a link.</span></span></li>
<li>Finally apply some sweet CSS to make the photo gallery look cool. If you&#8217;ve got some experience with CSS I&#8217;m sure you can apply your own styling but if you&#8217;re a bit stuck this is what I use on my blog:<code>a img {<br />
border:none;<br />
}<br />
.flickr_badge_image a{<br />
text-align:center;<br />
border:1px solid #433d33;<br />
margin:0 10px 10px 0;<br />
width:85px;<br />
height:85px;<br />
float:left;<br />
}<br />
.flickr_badge_image a:hover{<br />
width:95px;<br />
height:95px;<br />
margin:-5px 5px 5px -5px;<br />
border:1px solid #ef702e;<br />
}<br />
.flickr_badge_image img{<br />
margin-top:5px;<br />
}<br />
.flickr_badge_image a:hover img{<br />
margin-top:10px<br />
}</code></li>
</ol>
<p>That was fairly easy and depending on how you set it up when you change your photos on Flickr the photos on your website will change.</p>
]]></content:encoded>
			<wfw:commentRss>http://instantsolve.net/blog/2008/05/using-flickr-on-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
