<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Goksel Eryigit - Front-end Developer</title>
	
	<link>http://geryit.com/blog</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Tue, 14 Feb 2012 10:55:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/goksel" /><feedburner:info uri="goksel" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><itunes:explicit>no</itunes:explicit><itunes:subtitle>Just another WordPress site</itunes:subtitle><feedburner:emailServiceId>goksel</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Creating “Next Level” Search Form Using jQuery &amp; CSS3 [Webstuffshare]</title>
		<link>http://feedproxy.google.com/~r/goksel/~3/ruzGvHwPTKc/</link>
		<comments>http://geryit.com/blog/creating-next-level-search-form-using-jquery-css3-webstuffshare/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 10:55:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Css3]]></category>
		<category><![CDATA[Html5]]></category>
		<category><![CDATA[Out-source]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://geryit.com/blog/?p=1340</guid>
		<description><![CDATA[Lately we found ton of new style search form crafted beautifully using CSS3 and JavaScript. Apple&#8217;s for example, widen the input field when it receive focus from user. The question is &#8220;how far we can go for styling search form?&#8221;, in this tutorial we are going to move search form to the next level using [...]]]></description>
			<content:encoded><![CDATA[<div class="content-post">
<p>
		Lately we found ton of new style search form crafted beautifully using CSS3 and JavaScript. <a href="http://livepage.apple.com" target="_blank">Apple&#8217;s</a> for example, widen the input field when it receive focus from user. The question is &#8220;how far we can go for styling search form?&#8221;, in this tutorial we are going to move search form to the next level using jQuery &#038; CSS3.
	</p>
<p>
		<span id="more-2350"></span>
	</p>
<div class="button-show-implementation">
		<a href="http://webstuffshare.com/demo/NextLevelSearch/">Show Implementation</a>
	</div>
<div class="button-download-source">
		<a href="http://www.webstuffshare.com/download/NextLevelSearch.zip">Download Source</a>
	</div>
<div class="cleaner"></div>
<h3>Simple Style</h3>
<p>First to go we will create a simple animated search form that show only search button with search image on it. When the button receives a click, the input field will widen while the search image will move to left filling the left blank space before input text.</p>
<p>
		<img src="http://www.webstuffshare.com/wp-content/uploads/2012/02/simple-style2.jpg" alt="" title="simple style" class="aligncenter size-full wp-image-2352" /><br /> </br>
	</p>
<p>Based on the picture above, the HTML element will consists of 4 elements, a div for elements wrapper, an input text, an input button for search button and an image search. All of them will be stacked each other where the div wrapper is at the very bottom of the stack and image search at the very top. Here&#8217;s the HTML and CSS :</p>
<pre name="code" class="brush: html">
<div class="wrapper-simple">
<input type="text" value="Type and enter..." />
<input type="submit" value="" />
	<img src="images/search-icon-big.png" />
</div>
</pre>
<pre name="code" class="brush: css">
.wrapper-simple {
	text-align: center;
	margin: 0 auto;
	display: block;
	width: 60px;
	height: 45px;
	padding: 10px 5px;
	background: -webkit-gradient(linear, left top, left bottom, from(#f5fafe), to(#e2edf4));
	border-radius: 5px;
	box-shadow: inset rgba(255, 254, 255, 1) 0 0.1em 2px,
					#9bb6c9 0 1px 2px;
	position: relative;
}

.wrapper-simple input[type=submit] {
	margin-top: .2em;
	z-index: 2;
	position: relative;
	vertical-align: top;
	height: 43px;
	min-width: 55px;
	border-radius: 3px;
	border: 1px solid #aa7818;
	background: -webkit-gradient(linear, left top, left bottom, from(#ffb700), to(#ff8c00));
	box-shadow: inset rgba(255, 255, 255, .5) 0 0.1em 0.1em;
	cursor: pointer;
}

	.wrapper-simple input[type=submit]:active {
		box-shadow: inset rgba(0,0,0,.4) 0 1px 1px;
	}

	.wrapper-simple input[type=submit]:hover {
		background: -webkit-gradient(linear, left top, left bottom, from(#ffcb48), to(#ff9c23));
	}

.wrapper-simple input[type=text] {
	font-family: Arial;
	font-weight: bold;
	color: #1a3d51;
	background: #d8e6ef;
	border-radius:2px;
	padding: 10px 10px 15px 10px;
	width: 250px;
	border: 0;
	font-size: 16px;
	text-shadow: rgba(255, 255, 255, 0.7) 1px 1px 1px;
	box-shadow: inset rgba(0,0,0,.4) 0 1px 1px;
	position: absolute;
	width: 1px;
	z-index: 2;
	padding-left: 2em;
	margin-left: .2em;
}

.wrapper-simple img {
	position: absolute;
	top: 1.5em;
	left: 1.5em;
	z-index: 4;
}
</pre>
<p>Now we will read the click event on search button and animate the form using jQuery.</p>
<pre name="code" class="javascript">
$('.wrapper-simple input[type=submit]').toggle(function(){

	$('.wrapper-simple').animate({'width':'300px'})
	  .end().find('.wrapper-simple input[type=text]').animate({'width': '250px'})
	  .end().find('.wrapper-simple img').animate({'marginLeft': '-5px'})
	  .end().find(this).animate({'marginLeft':'22em'}).attr('value', 'CANCEL');

}, function() {

	$('.wrapper-simple').animate({'width':'60px'})
	  .end().find('.wrapper-simple input[type=text]').animate({'width': '1px'})
	  .end().find('.wrapper-simple img').animate({'marginLeft': '0'})
	  .end().find(this).animate({'marginLeft':'0'}).attr('value', '');

});
</pre>
<p>
		The script toggling user&#8217;s click. First click will widen the div wrapper and input text, move the search button to the edge of input text and move image search to fill the left blank space before input text. Second click will revert to normal.</p>
<h3>Cube Style</h3>
<p>
		After making simple animated search form, actually we aren&#8217;t moving too far. So we will make another experiment, how about show the search form rotating like a cube? Well, CSS3 properties like transform, perspective and animation seems very helpful. <strong>The thing that we must give more attention that the following code and demo currently work only on Safari 5+</strong>.
	</p>
<p>
		<img src="http://www.webstuffshare.com/wp-content/uploads/2012/02/cube-style2.jpg" alt="" title="cube style" class="aligncenter size-full wp-image-2354" /></p>
<p>Making a cube is a bit tricky, for vertical rotate and one direction (up to down) we can create a cube by making 2 div, first div as a front side of the cube and the second div as a top side. The top side div must be rotated so it will be like coming from the top when the cube rotating.</p>
<p>
		<img src="http://www.webstuffshare.com/wp-content/uploads/2012/02/layer2.jpg" alt="" title="layer" class="aligncenter size-full wp-image-2355" /></p>
<p>The structure of elements will be :</p>
<pre name="code" class="brush: html">
<div class="wrapper1">
<div class="content-wrapper1">
<div class="search-button1">
			<span><img src="images/search-icon.png" /></span>
		</div>
<div class="search-box1">
<input type="text" value="Type your keyword..." />
			<img src="images/close.png" />
		</div>
</div>
</div>
</pre>
<p>wrapper1 acting as wrapper for all elements inside, content-wrapper1 also as a wrapper that will be rotated, search button-1 as top side and search-box1 as front side. The styling :</p>
<pre name="code" class="brush: css">
.wrapper1 {
	display: block;
	width: 300px;
	margin: 0 auto;
	-webkit-perspective : 1200px;
}

	.search-button1 span {
		display: block;
		margin: 0 auto;
		background: #643904;
		border-radius: 30px;
		width: 30px;
		height: 30px;
		box-shadow: rgba(255,255,255,.3) 0 1px 0px;
	}

		.search-button1 span img {
			vertical-align: middle;
			padding-top: 7px;
		}

	.search-button1:hover {
		background: -webkit-gradient(linear, left top, left bottom, from(#ffcb48), to(#ff9c23));
	}

	.search-button1:active {
		margin-top: 0.2em;
		box-shadow: inset rgba(255, 254, 255, 0.2) 0 0.3em .3em,
						#8e620e 0 0.3em 0,
						rgba(0, 0, 0, 0.2) 0 0.5em 3px;
	}

.search-box1 {
	margin-top: -.6em;
	display: none;
	position: absolute;
	width: 300px;
	height: 50px;
	padding: 10px 6px;
	background: -webkit-gradient(linear, left top, left bottom, from(#f5fafe), to(#e2edf4));
	border: 1px solid #9bb6c9;
	border-bottom: 1px solid rgba(255,255,255,0.2);
	border-radius: 5px;
	box-shadow: inset rgba(255, 254, 255, 0.2) 0 0.3em .3em,
					#899faf 0 .5em 0px,
					rgba(0, 0, 0, 0.2) 0 .9em 3px;

	-webkit-transform:	rotate3d(1,0,0,90deg)
								translateZ(20px);
}

	.search-box1 input {
		font-family: Arial;
		font-weight: bold;
		color: #1a3d51;
		background: #d8e6ef;
		border-radius:2px;
		padding: 10px 10px 15px 10px;
		width: 250px;
		border: 0;
		font-size: 16px;
		text-shadow: rgba(255, 255, 255, 0.7) 1px 1px 1px;
		box-shadow: inset rgba(0,0,0,.4) 0 1px 1px;
	}

		.search-box1 input:focus {
			outline: none;
		}

	.search-box1 img {
		opacity: .5;
		position: absolute;
		margin: .6em 0 0 -2em;
		cursor: pointer;
		-webkit-transition: 0.5s linear;
	}

		.search-box1 img:hover {
			opacity: 1;
		}

.hide-search-button {
	display: none;
}

.show-search-button {
	display: block;
}

.show-search-box {
	display: block;
}

.showed-search-box {
	display: block;
	-webkit-transform: rotate3d(1,0,0,0deg);
}

.hidden-search-box {
	-webkit-transform:	rotate3d(1,0,0,90deg)
								translateZ(25px);
}

.switch-show {
	height: 50px;
	-webkit-transform-style: preserve-3d;
	-webkit-animation: showBox 0.5s ease-in-out;
}

.switch-hide {
	height: 50px;
	-webkit-transform-style: preserve-3d;
	-webkit-animation: hideBox 0.5s ease-in-out;
}

.switch-show {
	height: 50px;
	-webkit-transform-style: preserve-3d;
	-webkit-animation: showBox 0.5s ease-in-out;
}

.switch-hide {
	height: 50px;
	-webkit-transform-style: preserve-3d;
	-webkit-animation: hideBox 0.5s ease-in-out;
}

@-webkit-keyframes showBox{
	0% { -webkit-transform: rotate3d(1,0,0,0); }
	100% { -webkit-transform: rotate3d(1,0,0,-90deg); }
}

@-webkit-keyframes hideBox{
	0% { -webkit-transform: rotate3d(1,0,0,-90deg); }
	100% { -webkit-transform: rotate3d(1,0,0,0); }
}
</pre>
<p>We&#8217;re a half set up, now we will read the click event from the user and rotate the cube.</p>
<pre name="code" class="brush: javascript">
$('.search-button1').click(function() {

	$('.content-wrapper1').addClass('switch-show');
	$('.search-box1').addClass('show-search-box');

	setTimeout(function(){

		$('.content-wrapper1').removeClass('switch-show');
		$('.search-button1').removeClass('show-search-button').addClass('hide-search-button');
		$('.search-box1').addClass('showed-search-box');

	},480);
});

$('.search-box1 img').click(function() {

	$('.search-button1').removeClass('hide-search-button');
	$('.search-box1').addClass('hidden-search-box');
	$('.content-wrapper1').addClass('switch-hide');

	setTimeout(function(){

		$('.content-wrapper1').removeClass('switch-hide');
		$('.search-button1').removeClass('show-search-button');
		$('.search-box1').removeClass('show-search-box showed-search-box hidden-search-box');

	},480);

});
</pre>
<p>
		The script above act as an animation delegator, all animation handled by CSS. Since the CSS animation we describe before only works once and revert to the normal state, we force the current showed side to visible and other side to hidden until the animation works before revert back, this is do the trick. </p>
<h3>Cube Style With Animate</h3>
<p>At some point we might animate the front side before rotate the cube. Then we reduce the front side&#8217;s width and widen it before rotate.</p>
<p>
		<img src="http://www.webstuffshare.com/wp-content/uploads/2012/02/cube-style-animate2.jpg" alt="" title="cube style animate" class="aligncenter size-full wp-image-2353" /></p>
<pre name="code" class="brush: javascript">
$('.search-button2').click(function() {

	$('.arrow').hide();

	$(this).stop().animate({'width':'300px'}, 500, function() {

		$('.content-wrapper2').addClass('switch-show');
		$('.search-box2').addClass('show-search-box');

		setTimeout(function(){

			$('.content-wrapper2').removeClass('switch-show');
			$('.search-button2').removeClass('show-search-button').addClass('hide-search-button');
			$('.search-box2').addClass('showed-search-box');

		},480);

	});
});

$('.search-box2 img').click(function() {

	$('.search-button2').removeClass('hide-search-button');
	$('.search-box2').addClass('hidden-search-box');
	$('.content-wrapper2').addClass('switch-hide');

	$('.search-button2').addClass('show-search-button').stop().delay(500).animate({'width':'50px'}, 500, function() {

		$('.content-wrapper2').removeClass('switch-hide');
		$('.search-button2').removeClass('show-search-button');
		$('.search-box2').removeClass('show-search-box showed-search-box hidden-search-box');

		$('.arrow').show();

	});
});
</pre>
<p>
		We use jQuery&#8217;s <strong>animate()</strong> function to widen the front side&#8217;s width and reduce it back when user close the form. </p>
<h3>Conclusion</h3>
<p>CSS3 and jQuery combination help us improve current web user interface into unlimited state, depend on our imagination. Did I missed something? I&#8217;d love to hear.</p>
</div>
<img src="http://feeds.feedburner.com/~r/goksel/~4/ruzGvHwPTKc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://geryit.com/blog/creating-next-level-search-form-using-jquery-css3-webstuffshare/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<media:content url="http://feedproxy.google.com/~r/goksel/~5/LQIDzzAUlcA/NextLevelSearch.zip" fileSize="100060" type="application/zip" /><itunes:explicit>no</itunes:explicit><itunes:subtitle>Lately we found ton of new style search form crafted beautifully using CSS3 and JavaScript. Apple&amp;#8217;s for example, widen the input field when it receive focus from user. The question is &amp;#8220;how far we can go for styling search form?&amp;#8221;, in this</itunes:subtitle><itunes:summary>Lately we found ton of new style search form crafted beautifully using CSS3 and JavaScript. Apple&amp;#8217;s for example, widen the input field when it receive focus from user. The question is &amp;#8220;how far we can go for styling search form?&amp;#8221;, in this tutorial we are going to move search form to the next level using [...]</itunes:summary><itunes:keywords>Css3, Html5, Out-source, Tutorials</itunes:keywords><feedburner:origLink>http://geryit.com/blog/creating-next-level-search-form-using-jquery-css3-webstuffshare/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/goksel/~5/LQIDzzAUlcA/NextLevelSearch.zip" length="100060" type="application/zip" /><feedburner:origEnclosureLink>http://www.webstuffshare.com/download/NextLevelSearch.zip</feedburner:origEnclosureLink></item>
		<item>
		<title>Build Awesome Apps with CSS3 Animations [sitepoint.com]</title>
		<link>http://feedproxy.google.com/~r/goksel/~3/Ayk7R38ernk/</link>
		<comments>http://geryit.com/blog/build-awesome-apps-with-css3-animations/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 11:14:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cool Stuff]]></category>
		<category><![CDATA[Css3]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Fun Stuff]]></category>
		<category><![CDATA[Html5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Out-source]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://geryit.com/blog/?p=1329</guid>
		<description><![CDATA[Today’s HTML5 applications can provide awesome experiences thanks to the new CSS3 specifications. One of them is CSS3 Animations. It can help you building rich animations on HTML elements. This can provide interesting feedbacks to the users and enables fast &#38; fluid UIs. As those new animations are most of the time hardware accelerated by [...]]]></description>
			<content:encoded><![CDATA[<div class="format_text entry-content">
<p>
		Today’s HTML5 applications can provide awesome experiences thanks to the new CSS3 specifications. One of them is <strong>CSS3 Animations</strong>. It can help you building rich animations on HTML elements. This can provide interesting feedbacks to the users and enables fast &amp; fluid UIs. As those new animations are most of the time hardware accelerated by the GPU, they definitely raise the quality bar of the new generation of HTML5 applications.
	</p>
<p>
		According to the “CSS Animation Module Level 3” specification on the <a href="http://www.w3.org/TR/css3-animations/" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://www.w3.org']);">W3C site</a>, CSS3 Animations <em>introduces defined animations, which specify the values that CSS properties will take over a given time interval. This specification is an extension to CSS Transitions</em>.
	</p>
<p>
		As CSS3 Animation is an <strong>extension to CSS3 Transitions</strong>, you should first read the article of my colleague David Catuhe on Transitions here: <a href="http://blogs.msdn.com/b/eternalcoding/archive/2011/11/01/css3-transitions.aspx" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://blogs.msdn.com']);">Introduction to CSS3 Transitions</a>.
	</p>
<p>We’ll see in this article an interesting demo highlighting the potential of CSS3 animations, how to build simple animations &amp; how to handle fallback in JavaScript:</p>
<ol start="1">
<li><a href="http://blogs.msdn.com/b/davrous/archive/2011/12/06/introduction-to-css3-animations.aspx#intro" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://blogs.msdn.com']);">CSS3 Animationsa></li>
<li><a href="http://blogs.msdn.com/b/davrous/archive/2011/12/06/introduction-to-css3-animations.aspx#support" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://blogs.msdn.com']);">Browsers Support</a></li>
<li><a href="http://blogs.msdn.com/b/davrous/archive/2011/12/06/introduction-to-css3-animations.aspx#fallback" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://blogs.msdn.com']);">CSS3 Animations JavaScript fallback library</a></li>
<li><a href="http://blogs.msdn.com/b/davrous/archive/2011/12/06/introduction-to-css3-animations.aspx#conclusion" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://blogs.msdn.com']);">Conclusion</a></li>
</ol>
<p>Let’s first start by quickly demonstrating what CSS3 Animations are. Here is a sample animation of a Star Wars AT-AT which uses CSS3 Animations to animate parts of the transport (and which will fall back to JavaScript if your browser doesn’t support CSS3 Animations):</p>
<div>
		<script type='text/javascript'>
			GA_googleFillSlot("InArticle_728x90_1");
		</script>
	</div>
</p>
<p>
		<iframe style="border-width: 0px; border-style: solid; border-color: #ffffff;" src="http://david.blob.core.windows.net/html5/css3atat/index.htm" scrolling="no" width="716" height="570"></iframe>
	</p>
<p>
		You can test this sample also in a separate window here: <a title="http://david.blob.core.windows.net/html5/css3atat/index.htm" href="http://david.blob.core.windows.net/html5/css3atat/index.htm" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://david.blob.core.windows.net']);">http://david.blob.core.windows.net/html5/css3atat/index.htm</a>
	</p>
<p>
		<strong><span style="text-decoration: underline;">Note:</span></strong> this sample has been tested successfully with native animations under IE10 PP3/PP4, Chrome 15, Firefox 8 &amp; iPad 2 and with JS fallback under IE9 desktop &amp; mobile (Windows Phone). For an unknown reason, it behaves in weird way under Opera 11.50 but works fine with the 11.60. Moreover, our lovely blogging platform is most of the time forcing the IE9 rendering engine via a meta tag. To force it back to the IE10 standards mode, press the F12 key and change the value of “Document Mode” back to IE10. Otherwise, view the demo in a separate window.
	</p>
<p>
		This sample is based on the awesome work done by <a href="http://twitter.com/acalzadilla" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://twitter.com']);">Anthony Calzadilla</a>. You can check other incredible demos on his website here: <a href="http://www.anthonycalzadilla.com/" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://www.anthonycalzadilla.com']);">http://www.anthonycalzadilla.com</a> . I’m a huge fan of the <a href="http://www.anthonycalzadilla.com/i-twitty-the-fool/" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://www.anthonycalzadilla.com']);">I twitty the fool</a> sample using SVG &amp; CSS3 Animation for instance.
	</p>
<h3>CSS3 Animations</h3>
<h4>Introduction</h4>
<p>Let’s first review on what you can play to build the animations. CSS3 Animations works basically on the same values as CSS3 Transition.</p>
<p>Here they are:</p>
<ul>
<li><strong>color</strong>: interpolated via red, green, blue and alpha components (treating each as a number, see below)</li>
<li><strong>length</strong>: interpolated as real numbers.</li>
<li><strong>percentage</strong>: interpolated as real numbers.</li>
<li><strong>integer</strong>: interpolated via discrete steps (whole numbers). The interpolation happens in real number space and is converted to an integer using floor().</li>
<li><strong>number</strong>: interpolated as real (floating point) numbers.</li>
<li><strong>transform list</strong>: see CSS Transforms specification: <a href="http://www.w3.org/TR/css3-2d-transforms/" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://www.w3.org']);">http://www.w3.org/TR/css3-2d-transforms/</a></li>
<li><strong>rectangle</strong>: interpolated via the x, y, width and height components (treating each as a number).</li>
<li><strong>visibility</strong>: interpolated via a discrete step. The interpolation happens in real number space between 0 and 1, where 1 is &#8220;visible&#8221; and all other values are &#8220;hidden&#8221;.</li>
<li><strong>shadow</strong>: interpolated via the color, x, y and blur components (treating them as color and numbers where appropriate). In the case where there are lists of shadows, the shorter list is padded at the end with shadows whose color is transparent and all lengths (x, y, blur) are 0.</li>
<li><strong>gradient</strong>: interpolated via the positions and colors of each stop. They must have the same type (radial or linear) and same number of stops in order to be animated.</li>
<li><strong>paint server</strong> (SVG): interpolation is only supported between: gradient to gradient and color to color. They then work as above.</li>
<li><strong>space-separated list of above</strong>: If the lists have the same number of items, each item in the list is interpolated using the rules above. Otherwise, no interpolation.</li>
<li><strong>a shorthand property</strong>: If all the parts of a shorthand can be animated, then interpolation is performed as if each property was individually specified.</li>
</ul>
<p>And the following properties must be supported for animations:</p>
<ul>
<li>background-color (<em>color</em>)
		</li>
<li>background-image (<em>only gradients</em>)
		</li>
<li>background-position (<em>percentage and length</em>)
		</li>
<li>border-bottom-color (<em>color</em>)
		</li>
<li>border-bottom-width (<em>length</em>)
		</li>
<li>border-color (<em>color</em>)
		</li>
<li>border-left-color (<em>color</em>)
		</li>
<li>border-left-width (<em>length</em>)
		</li>
<li>border-right-color (<em>color</em>)
		</li>
<li>border-right-width (<em>length</em>)
		</li>
<li>border-spacing (<em>length</em>)
		</li>
<li>border-top-color (<em>color</em>)
		</li>
<li>border-top-width (<em>length</em>)
		</li>
<li>border-width (<em>length</em>)
		</li>
<li>bottom (<em>length and percentage</em>)
		</li>
<li>color (<em>color</em>)
		</li>
<li>crop (<em>rectangle</em>)
		</li>
<li>font-size (<em>length and percentage</em>)
		</li>
<li>font-weight (<em>number</em>)
		</li>
<li>grid-* (<em>various</em>)
		</li>
<li>height (<em>length and percentage</em>)
		</li>
<li>left (<em>length and percentage</em>)
		</li>
<li>letter-spacing (<em>length</em>)
		</li>
<li>line-height (<em>number, length and percentage</em>)
		</li>
<li>margin-bottom (<em>length</em>)
		</li>
<li>margin-left (<em>length</em>)
		</li>
<li>margin-right (<em>length</em>)
		</li>
<li>margin-top (<em>length</em>)
		</li>
<li>max-height (<em>length and percentage</em>)
		</li>
<li>max-width (<em>length and percentage</em>)
		</li>
<li>min-height (<em>length and percentage</em>)
		</li>
<li>min-width (<em>length and percentage</em>)
		</li>
<li>opacity (<em>number</em>)
		</li>
<li>outline-color (<em>color</em>)
		</li>
<li>outline-offset (<em>integer</em>)
		</li>
<li>outline-width (<em>length</em>)
		</li>
<li>padding-bottom (<em>length</em>)
		</li>
<li>padding-left (<em>length</em>)
		</li>
<li>padding-right (<em>length</em>)
		</li>
<li>padding-top (<em>length</em>)
		</li>
<li>right (<em>length and percentage</em>)
		</li>
<li>text-indent (<em>length and percentage</em>)
		</li>
<li>text-shadow (<em>shadow</em>)
		</li>
<li>top (<em>length and percentage</em>)
		</li>
<li>vertical-align (<em>keywords, length and percentage</em>)
		</li>
<li>visibility (<em>visibility</em>)
		</li>
<li>width (<em>length and percentage</em>)
		</li>
<li>word-spacing (<em>length and percentage</em>)
		</li>
<li>z-index (<em>integer</em>)
		</li>
<li>zoom (<em>number</em>)
		</li>
</ul>
<h4>SVG</h4>
<p>
		The properties of SVG objects are animatable when they are defined as <strong>animatable:true</strong> in the SVG specification: <a href="http://www.w3.org/TR/SVG/struct.html" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://www.w3.org']);">http://www.w3.org/TR/SVG/struct.html</a>. But at the time where this article is written, I didn’t manage to combine CSS3 Animation directly on SVG elements in any of the latest browsers versions. Today’s samples on the web are then doing a little trick: they are embedding SVG resources into different DIV animated by CSS3 like the <a href="http://www.anthonycalzadilla.com/i-twitty-the-fool/" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://www.anthonycalzadilla.com']);">I twitty the fool</a> sample.
	</p>
<h4>Declarations</h4>
<p>To declare an animation in a CSS file, here is the kind of generic code you’ll need to write:</p>
<pre class="brush:css">@keyframes name_of_the_animation {
  from {
    property_to_animate: initial_value;
  }
  50% {
    property_to_animate: intermediate_value;
  }
  to {
    property_to_animate: final_value;
  }
}</pre>
<p>Which could also be written like that:</p>
<pre class="brush:css">@keyframes name_of_the_animation {
  0% {
    property_to_animate: initial_value;
  }
  50% {
    property_to_animate: intermediate_value;
  }
  100% {
    property_to_animate: final_value;
  }
}</pre>
<p>
		This animation definition declares 3 steps 0, 50 &amp; 100%. You should at least set a <strong><em>from</em></strong> (or 0%) and a <strong><em>to</em></strong> (or 100%) steps to build a correct animation (minimum 2 steps thus). Once done, you may add as many keyframes as you’d like between 0 and 100% to handle precisely the various steps of your animations.
	</p>
<p>Once the definition is declared, you can affect it to an element using the classical CSS3 selectors and you’ll need also to configure the animation options. Here the kind of generic blocks you’ll see:</p>
<pre class="brush:css">#id_of_the_html_element {
    animation-name: name_of_the_animation;
    animation-duration: number_of_seconds s;
    animation-iteration-count: number | infinite;
}</pre>
<p>To better understand, let’s review a real sample. First of all, as the CSS3 Animations specification is still in a draft stage, you’ll need to use the appropriate vendor prefix. Let’s use IE10 as a sample with the –ms prefix then. Let’s now see how the head of our AT-AT is moving.</p>
<p>Here’s the animation declaration:</p>
<pre class="brush:css">@-ms-keyframes rotate-skull {
    0% {
        -ms-transform: rotate(0deg)
    }
    25% {
        -ms-transform: rotate(15deg)
    }
    50% {
        -ms-transform: rotate(-5deg)
    }
    55% {
        -ms-transform: rotate(0deg)
    }
    75% {
        -ms-transform: rotate(-10deg)
    }
    100% {
        -ms-transform: rotate(0deg)
    }
}</pre>
<p>We’ve got 6 steps (0, 25, 50, 55, 75 &amp; 100%) working on the CSS3 2D transform attributes by changing the value of the rotation.</p>
<p>The animation is then applied via this CSS rule:</p>
<pre class="brush:css">#skull
{
    -ms-animation-name: rotate-skull;
    -ms-animation-duration: 7s;
    -ms-animation-iteration-count: infinite;
}</pre>
<p>
		We’re targeting the<br />
		<code>&lt;div&gt;</code><br />
		element having the “<br />
		<code><br />
			id=<strong>skull</strong><br />
		</code><br />
		” and we’re applying the animation named “<strong><code>rotate-skull</code></strong>” on it. The animation will have to be completed in <strong>7s</strong> and be played an <strong>infinite</strong> number of times.
	</p>
<p>Here is the living result if your browser supports CSS3 Animations:</p>
<p>
		<iframe style="border-bottom: #ffffff 0px solid; border-left: #ffffff 0px solid; border-top: #ffffff 0px solid; border-right: #ffffff 0px solid" height="200" src="http://david.blob.core.windows.net/html5/css3atat/AnimSkullATAT.htm" width="400" scrolling="no"></iframe>
	</p>
<p>We could have written this rule in a shorter manner using the animation shorthand property:</p>
<pre class="brush:css">#skull {
    -ms-animation: rotate-skull 7s infinite;
}</pre>
<p>
		The animations will be triggered as soon as a matching rule is applied. You can then play or stop animations simply via <strong>JavaScript</strong> or via CSS3 to play with the <strong>classes affected to a tag</strong>.
	</p>
<h4>Non-linear animations</h4>
<p>The “animation-timing-function” property can be used if you want non-linear animations. You can even mix the type of timing functions during each keyframe.</p>
<p>
		Basically, CSS3 animations will use <a href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B.C3.A9zier_curves" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://en.wikipedia.org']);">cubic bezier curve</a> to smooth the animation by computing different speed over its duration.
	</p>
<p>The following functions are supported:</p>
<ul>
<li><em>linear</em>: Constant speed</li>
<li><em>cubic-bezier</em>: Speed will be computed according to a cubic bezier curve define by two control points : P0 and P1 (so you will have to define 4 values here : P0x, P0y and P1x, P1y.</li>
<li><em>ease</em>: Speed will be computed with cubic-bezier(0.25, 0.1, 0.25, 1)</li>
<li><em>ease-in</em>: Speed will be computed with cubic-bezier(0.42, 0, 1, 1)</li>
<li><em>ease-inout</em>: Speed will be computed with cubic-bezier(0.42, 0, 0.58, 1)</li>
<li><em>ease-out</em>: Speed will be computed with cubic-bezier(0, 0, 0.58, 1)</li>
</ul>
<p>
		Here is a simulation tool written by <a href="http://blogs.msdn.com/b/eternalcoding/archive/2011/11/01/css3-transitions.aspx" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://blogs.msdn.com']);">David Catuhe</a> that uses pure JavaScript to show the impact of each timing function:
	</p>
<p>
		<iframe style="border-bottom: #ffffff 0px solid; border-left: #ffffff 0px solid; border-top: #ffffff 0px solid; border-right: #ffffff 0px solid" height="650" src="http://www.catuhe.com/msdn/transitions/easingfunctions.htm" width="1000"></iframe>
	</p>
<p>
		<strong><span style="text-decoration: underline;">Note:</span></strong> this tool uses in-line SVG supported by Firefox, Chrome, Opera 11.60 &amp; IE9/10. It won’t work properly under Opera 11.50 &amp; Safari on iPad thus.
	</p>
<p>This is an awesome tool using SVG. You can even play with your mouse on the custom function to edit the curve. If you’d like to know more about this tool, please again have a look to David’s article.</p>
<p>
		If your browser supports CSS3 animations, let’s now see a simple demo using <strong>easing functions to animate a canvas tag</strong> containing an animated sprite with CSS3.
	</p>
<p>Here is the CSS3 animations code that will be used in this demo:</p>
<pre class="brush:css">@-ms-keyframes demo {
    from {
    -ms-animation-timing-function: ease;
    -ms-transform: translateX(0px);
    }
    50% {
    -ms-animation-timing-function: ease-in;
    -ms-transform: translateX(300px);
    }
    to {
    -ms-animation-timing-function: ease-inout;
    -ms-transform: translateX(900px);
    }
}
&nbsp;
#testCanvas
{
    -ms-animation-delay: 0s;
    -ms-animation-duration: 6s;
    -ms-animation-iteration-count: infinite;
    -ms-animation-name: demo;
}</pre>
<p>As well as all the vendor prefixes variations to make sure it works also in Google Chrome &amp; Mozilla Firefox. And here’s the living output:</p>
<p>
		<iframe style="border-bottom: #ffffff 0px solid; border-left: #ffffff 0px solid; border-top: #ffffff 0px solid; border-right: #ffffff 0px solid" height="90" src="http://david.blob.core.windows.net/html5/css3animcanvas/sprites.htm" width="1000"></iframe>
	</p>
<p>If your browser doesn’t support CSS3 Animation but support canvas, the sprite’s running animation should be displayed but the character won’t move through the width of the screen.</p>
<p>
		<strong><span style="text-decoration: underline;">Note:</span></strong> if you’d like to know more about canvas and sprites animation, you can have a look to this article: <a href="http://blogs.msdn.com/b/davrous/archive/2011/07/21/html5-gaming-animating-sprites-in-canvas-with-easeljs.aspx" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://blogs.msdn.com']);">HTML5 Gaming: animating sprites in Canvas with EaselJS</a>
	</p>
<h4>Delay</h4>
<p>The “animation-delay” property simply allows an animation to begin execution some time after it is applied.</p>
<h4>Events</h4>
<p>
		3 <strong>events</strong> could be raised during an animation. They are named “Animation<em>Start</em>”, “Animation<em>End</em>” and “Animation<em>Iteration</em>”. Depending on your browser, the correct name will be for instance:
	</p>
<ul>
<li>Chrome:<em> webkitAnimationEnd</em></li>
<li>Firefox: <em>mozAnimationEnd</em></li>
<li>Internet Explorer:<em> MSAnimationEnd</em></li>
</ul>
<p>The event will give you the following details:</p>
<ul>
<li><em>animationName</em>: name of the animation which raised the event</li>
<li><em>elapsedTime</em>: the amount of time the animation has been running, in seconds</li>
</ul>
<p>Here is an usage sample for IE10:</p>
<pre class="brush:css">elementToAnimate.addEventListener("MSAnimationEnd", function () {
    alert("the end !");
}, false);</pre>
<h3>More about CSS3 animations</h3>
<p>CSS3 animations are really useful for 2 main reasons:</p>
<ul>
<li><strong>Hardware acceleration:</strong> CSS3 Animations are most of the time directly handled by the GPU and could produce smoother results. This could then be a very interesting approach for mobile devices.</li>
<li><strong>Better separation between code and design</strong>: I know there is some debates on this point but with David, we think that a developer shouldn’t be aware of animations or anything related to design as much as possible. In the same way the designer/artist must not be aware of JavaScript. CSS3 offers then this possibility and could let the designers work with their classical tools to generate the appropriate animations on elements, between screens, etc.</li>
</ul>
<p>
		To highlight this importance in performance, the following HTML5 game I wrote using a full frame &lt;canvas&gt;: <a title="http://blogs.msdn.com/b/davrous/archive/2011/09/09/html5-platformer-the-complete-port-of-the-xna-game-to-lt-canvas-gt-with-easeljs.aspx" href="http://blogs.msdn.com/b/davrous/archive/2011/09/09/html5-platformer-the-complete-port-of-the-xna-game-to-lt-canvas-gt-with-easeljs.aspx" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://blogs.msdn.com']);">HTML5 Platformer</a> run at 60 fps in IE9/IE10 on my PC but at 10 fps max on a iPad 2. This is because its CPU is much more limited and the iPad is currently not hardware-accelerating &lt;canvas&gt;. Using CSS3 Transitions/Animations to animate several smaller &lt;canvas&gt; elements could provide a huge performance boost for this game. Think about it when you’re targeting mobile devices!
	</p>
<h3>Browsers Support</h3>
<p>
		Since the Platform Preview 3 of IE10 available in the <a href="http://msdn.microsoft.com/en-us/windows/apps/br229516" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://msdn.microsoft.com']);">Windows Developer Preview</a>, we’re supporting CSS3 Animations. And as you can see on the following report produced by <a href="http://caniuse.com/#search=CSS3%20animation" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://caniuse.com']);">caniuse.com</a>, the CSS3 animations are now supported on a wide range of browsers:
	</p>
<p>
		<img class="alignnone size-full wp-image-51037" title="fig2" src="http://cdn.sitepoint.com/wp-content/uploads/2012/02/fig2.png" alt="browser support" width="761" height="275" />
	</p>
<p>
		But as the specification is not finished yet (<em>working draft</em>), you must use vendor’s prefixes such as –ms-, –moz-, –webkit-, –o- to make a cross-browsers compatible application.
	</p>
<p>But the question could be: how to handle browsers that don’t support this new feature?</p>
<p>
		First option is to just do nothing. Thanks to the beauty of graceful degradation, you could just let the user only see a static image if you’ve worked correctly. This is for instance the case of these 2 original samples of Anthony: <a href="http://www.anthonycalzadilla.com/i-twitty-the-fool/" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://www.anthonycalzadilla.com']);">I Twitty the Fool!</a> and <a href="http://www.anthonycalzadilla.com/css3-ATAT/" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://www.anthonycalzadilla.com']);">Pure CSS3 AT-AT Walker</a> . When watched in IE9, it looks like we only have a static image. When watched in IE10, the very same code shows nice animations. IE10 users will then have an enhanced version while IE9 will still be able to view and use properly the website. The more modern your browser is, the more visual bonus you will have.
	</p>
<p>The second option is to detect the feature via a JS library like Modernizr and try to offer the same animation via a JavaScript library that will mimic the animations. This is what we usually call a fallback mechanism. Unfortunately, I haven’t found today a working &amp; complete JS library that could replace CSS3 animations when not supported by the browser.</p>
<p>I have then written a sample JS library more or less specifically designed for the AT-AT sample.</p>
<h3>CSS3 Animations JavaScript fallback library</h3>
<p>Animations are nothing more than a series of transitions separated by a certain duration defined via the keyframes. I’ve then reused the concepts built by David Catuhe in his transitions helper library. I let you reviewing his article to check the base of the concepts behind the code.</p>
<p>On my side, I’ve added some support to animate the CSS3 2D Transform rotation &amp; translation values and a way to iterate through the keyframes.</p>
<p>Here is the main part of the library you need to review:</p>
<pre class="brush:css">// Animation object
// It need the HTML targeted element, the name of the animation, its duration &amp; iteration count and
// the keyframes contained in an array object
// View the animation simply as a sequence of transitions played a certain number of times
ANIMATIONSHELPER.animation = function (target, name, duration, iterationcount, keyframes) {
    // saving the properties values
    this.name = name;
    this.duration = duration;
    this.iterationcount = iterationcount;
    this.target = target;
&nbsp;
    var elapsedtime = 0;
    var keyframeduration = 0;
    var elapsedtime = 0;
&nbsp;
    // Transforming the percentage of each keyframe into duration value
    for (var i = 0; i &lt; keyframes.length; i++) {
        keyframeduration = ((keyframes[i].percentage * duration) / 100) - elapsedtime;
        keyframes[i].duration = keyframeduration;
        elapsedtime += keyframeduration;
    }
&nbsp;
    this.currentTransition = { isPlaying: false };
    this.keyframes = keyframes;
    this.keyframesCount = keyframes.length;
    this.currentKeyFrameIndex = 0;
&nbsp;
    // The nextTransition() function return the next transition to run
    // based on the current keyframe to play
    this.nextTransition = function (keyframe, ease, customEaseP1X, customEaseP1Y, customEaseP2X, customEaseP2Y) {
        var properties = [];
        var finalValues = [];
        var transition;
&nbsp;
        // Compared to the original TRANSITIONSHELPER of David Catuhe
        // We need a specific code to play with the CSS3 2D Transform properties values
        if (keyframe.propertyToAnimate === "transform") {
            for (var i = 0; i &lt; keyframe.transformType.length; i++) {
                properties.push(keyframe.transformType[i].type);
                if (keyframe.transformType[i].type == "rotate") {
                    finalValues.push({ deg: keyframe.transformType[i].value1 });
                }
                else {
                    finalValues.push({ x: keyframe.transformType[i].value1, y: keyframe.transformType[i].value2 });
                }
            }
&nbsp;
            // Create a new transition
            transition = {
                name: this.name + this.currentKeyFrameIndex,
                target: this.target,
                properties: properties,
                finalValues: finalValues,
                originalValues: ANIMATIONSHELPER.extractValues(target.style[ANIMATIONSHELPER.currentTransformProperty], this.name),
                duration: keyframe.duration,
                startDate: (new Date).getTime(),
                currentDate: (new Date).getTime(),
                ease: ease,
                customEaseP1X: customEaseP1X,
                customEaseP2X: customEaseP2X,
                customEaseP1Y: customEaseP1Y,
                customEaseP2Y: customEaseP2Y,
                isPlaying: true,
                type: "transform"
            };
&nbsp;
            return transition;
        }
        // If it's a classic property to animate, we're using more or less the TRANSITIONSHELPER as-is
        else {
            return TRANSITIONSHELPER.transition(this.target, keyframe.propertyToAnimate, keyframe.value, keyframe.duration, TRANSITIONSHELPER.easingFunctions.linear);
        }
    };
&nbsp;
    // each animation object has a tick function
    // that will be called every 17 ms (to target 60 fps)
    // This ticker is monitoring the current state of the transition and
    // create a new transition as soon as the old one is finished/dead
    this.tick = function () {
        if (this.iterationcount &gt; 0) {
            if (!this.currentTransition.isPlaying) {
                this.currentTransition = this.nextTransition(this.keyframes[this.currentKeyFrameIndex], ANIMATIONSHELPER.easingFunctions.linear);
                // We're using our own global ticker only for the 2D transformations
                // Otherwise, we're using the one from the TRANSITIONSHELPER library
                if (this.currentTransition.type === "transform") {
                    ANIMATIONSHELPER.currentTransitions.push(this.currentTransition);
                }
                this.currentKeyFrameIndex++;
&nbsp;
                // We've reached the last keyframe (100%). We're starting back from the beginning
                if (this.currentKeyFrameIndex &gt;= this.keyframesCount) {
                    this.currentKeyFrameIndex = 0;
                    this.iterationcount--;
                }
            }
        }
    };
};</pre>
<p>
		The first part of the code is iterating through each keyframe to compute the exact duration specified by each percentage. We’re then defining a<br />
		<code>nextTransition()</code><br />
		function that will dynamically build the next transition to play based on the current index into the keyframes collection. At last, we’ve got a<br />
		<code>tick()</code><br />
		function that will monitor the current state of the transition applied. Once the transition is finished or dead, it asks for the next transition, push it to the stack of transitions to be played and moves the indexes.
	</p>
<p>
		This<br />
		<code>tick()</code><br />
		function is called thanks to this code:
	</p>
<pre class="brush:js">ANIMATIONSHELPER.launchAnimation = function (animation) {
    // Launching the tick service if required
    if (ANIMATIONSHELPER.tickIntervalID == 0) {
        ANIMATIONSHELPER.tickIntervalID = setInterval(ANIMATIONSHELPER.tick, 17);
    }
&nbsp;
    // Little closure to launch the tick method on the appropriate animation instance
    setInterval(function () { animation.tick(); }, 17);
};</pre>
<p>At last, we have this kind of code that helps us building the keyframes:</p>
<pre class="brush:js">// Object to build a new generic keyframe (not working on the CSS3 2D Transform properties thus)
ANIMATIONSHELPER.keyframe = function (percentage, propertyToAnimate, value) {
    this.percentage = percentage;
    this.propertyToAnimate = propertyToAnimate;
    this.value = value;
};
&nbsp;
//Objects to build specific rotation keyframes
ANIMATIONSHELPER.rotationkeyframe = function (percentage, value) {
    this.percentage = percentage;
    this.propertyToAnimate = "transform";
    this.transformType = [];
    this.transformType.push(new ANIMATIONSHELPER.transformType("rotate", value));
};</pre>
<p>To highlight its usage, let’s recreate the previous simple CSS3 Animation skull sample with this library :</p>
<pre class="brush:js">// number of times you'd like the animations to be run
var iterationsNumber = 100;
&nbsp;
var skullElement = document.getElementById("skull");
var keyframes = [];
keyframes.push(new ANIMATIONSHELPER.rotationkeyframe(25, 15));
keyframes.push(new ANIMATIONSHELPER.rotationkeyframe(50, -5));
keyframes.push(new ANIMATIONSHELPER.rotationkeyframe(55, 0));
keyframes.push(new ANIMATIONSHELPER.rotationkeyframe(75, -10));
keyframes.push(new ANIMATIONSHELPER.rotationkeyframe(100, 0));
&nbsp;
var animation1 = new ANIMATIONSHELPER.animation(skullElement, "rotate-skull", 7000,
                            iterationsNumber, keyframes);
&nbsp;
ANIMATIONSHELPER.launchAnimation(animation1, ANIMATIONSHELPER.easingFunctions.linear);</pre>
<p>And here is the result that will now work in every browser supporting CSS3 2D Transform:</p>
<p>
		<iframe style="border-bottom: #ffffff 0px solid; border-left: #ffffff 0px solid; border-top: #ffffff 0px solid; border-right: #ffffff 0px solid" height="200" src="http://david.blob.core.windows.net/html5/css3atat/indexSkullJS.htm" width="400" scrolling="no"></iframe>
	</p>
<p>At last, the very first sample demonstrated at the beginning of this article uses Modernizr to check the support for CSS3 Animations. If it’s not the case, it loads the code that will mimic the keyframes defined in the file master.css, moz-master.css &amp; ms-master.css :</p>
<pre class="brush:js">// Checking if CSS3 animations is supported
if (!Modernizr.cssanimations) {
// if so, we can use our JS fallback library
    supportElement.innerHTML = "CSS3 Animations &lt;strong&gt;are not supported&lt;/strong&gt;";
    LoadJSAnimationsFallback();
}
else {
    // if CSS3 animation is supported, we have nothing to do.
    // The *master.css stylesheets will be automatically applied &amp; used.
    supportElement.innerHTML = "CSS3 Animations &lt;strong&gt;are supported&lt;/strong&gt;";
}</pre>
<p>
		The <em>LoadJSAnimationsFallback()</em> function is defined into <em>jsfallback-master.js</em> which simply contains all the keyframes declarations and the 19 animations needed to mimic the behavior created by Anthony in pure CSS3. In this approach, the designer then needs to rewrite all rules using the library. Another approach could be to parse one of the CSS file using an XHR call and to create dynamically the JavaScript calls to the library. This needs more work as you almost need to reimplement the CSS3 animations specifications in JavaScript!
	</p>
<p>You now have an idea on the way to build a fallback mechanism to support more browsers while starting to use the latest CSS3 specifications.</p>
<p>
		You can download the files for the main sample here: <a title="http://david.blob.core.windows.net/html5/css3atat/CSS3ATATNonMinified.zip" href="http://david.blob.core.windows.net/html5/css3atat/CSS3ATATNonMinified.zip" onclick="javascript:_gaq.push(['_trackEvent','download','http://david.blob.core.windows.net/html5/css3atat/CSS3ATATNonMinified.zip']);">http://david.blob.core.windows.net/html5/css3atat/CSS3ATATNonMinified.zip</a>
	</p>
<p>It contains the unminified versions of the animationsHelper.js, transitionsHelper.js, jsfallback-master.js JavaScript files as well as the various CSS3 declinaison files for the main vendors prefixes.</p>
<h3>Conclusion</h3>
<p>CSS3 Animations is a powerful technology to push HTML5 applications to a new level. It offers interesting scenarios. Designers could use it to create a new generation of UI screens with smooth &amp; fluid animations without the need of developers. As it’s hardware-accelerated most of the time, developers should also pay attention to this specification. At last, both could collaborate. Designers could work on a series of predefined animations covering most scenarios. Developers could then create JavaScript libraries that will implement those animations. This library could offer in a transparent way 2 implementations: a dynamic generation of CSS3 on the fly or a fallback for older browsers.</p>
<h3>Going further</h3>
<ul>
<li>Article about CSS3 Transitions by David Catuhe: <a href="http://blogs.msdn.com/b/eternalcoding/archive/2011/11/01/css3-transitions.aspx" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://blogs.msdn.com']);">Introduction to CSS3 Transitions</a></li>
<li>CSS3 Animations specifications: <a title="http://www.w3.org/TR/css3-animations/" href="http://www.w3.org/TR/css3-animations/" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://www.w3.org']);">http://www.w3.org/TR/css3-animations/</a></li>
<li>IE Test Drive on CSS3 animations: <a title="http://ie.microsoft.com/testdrive/Graphics/hands-on-css3/hands-on_animations.htm" href="http://ie.microsoft.com/testdrive/Graphics/hands-on-css3/hands-on_animations.htm" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://ie.microsoft.com']);">http://ie.microsoft.com/testdrive/Graphics/hands-on-css3/hands-on_animations.htm</a></li>
</ul>
<p>
		<strong>Other useful posts:</strong>
	</p>
<ul>
<li>Events are relatively limited in the CSS3 Animation spec. Joe Lambert is proposing an interesting solution to trigger events on each keyframe: <a href="http://blog.joelambert.co.uk/2011/05/20/css-animation-keyframe-events-javascript-solution/" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://blog.joelambert.co.uk']);">CSS Animation Keyframe Events (Javascript solution)</a></li>
</ul>
</div>
<img src="http://feeds.feedburner.com/~r/goksel/~4/Ayk7R38ernk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://geryit.com/blog/build-awesome-apps-with-css3-animations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<media:content url="http://feedproxy.google.com/~r/goksel/~5/b7ABXivOZgA/CSS3ATATNonMinified.zip" fileSize="251415" type="application/x-zip-compressed" /><itunes:explicit>no</itunes:explicit><itunes:subtitle>Today’s HTML5 applications can provide awesome experiences thanks to the new CSS3 specifications. One of them is CSS3 Animations. It can help you building rich animations on HTML elements. This can provide interesting feedbacks to the users and enables fa</itunes:subtitle><itunes:summary>Today’s HTML5 applications can provide awesome experiences thanks to the new CSS3 specifications. One of them is CSS3 Animations. It can help you building rich animations on HTML elements. This can provide interesting feedbacks to the users and enables fast &amp;#38; fluid UIs. As those new animations are most of the time hardware accelerated by [...]</itunes:summary><itunes:keywords>Cool Stuff, Css3, Development, Fun Stuff, Html5, Javascript, Out-source, Tips and Tricks, Tutorials</itunes:keywords><feedburner:origLink>http://geryit.com/blog/build-awesome-apps-with-css3-animations/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/goksel/~5/b7ABXivOZgA/CSS3ATATNonMinified.zip" length="251415" type="application/x-zip-compressed" /><feedburner:origEnclosureLink>http://david.blob.core.windows.net/html5/css3atat/CSS3ATATNonMinified.zip</feedburner:origEnclosureLink></item>
		<item>
		<title>Amazing things to do with PHP and cURL</title>
		<link>http://feedproxy.google.com/~r/goksel/~3/G7fJ-d509o8/</link>
		<comments>http://geryit.com/blog/amazing-things-to-do-with-php-and-curl/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 09:25:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Out-source]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://geryit.com/blog/?p=1325</guid>
		<description><![CDATA[cURL, and its PHP extension libcURL, are very useful tools for tasks like simulating a web browser, submit forms or login to a web service. In this article, I’m going to show you some amazing things that you can do using PHP and cURL. Check if a specific website is available Want to know if [...]]]></description>
			<content:encoded><![CDATA[<p>cURL, and its PHP extension libcURL, are very useful tools for tasks like simulating a web browser, submit forms or login to a web service. In this article, I’m going to show you some amazing things that you can do using PHP and cURL.</p>
<h2>Check if a specific website is available</h2>
<p>Want to know if a specific website is available? cURL is here to help. This script can be used with a cron job to monitor your websites.</p>
<p>Don&#8217;t forget to update the script with the url you want to check on line 3. Once done, just paste it somewhere and it will let you know about the site availability.</p>
<pre>
&lt;?php

       if (isDomainAvailible(&#39;http://www.css-tricks.com&#39;))
       {
               echo &quot;Up and running!&quot;;
       }
       else
       {
               echo &quot;Woops, nothing found there.&quot;;
       }

       //returns true, if domain is availible, false if not
       function isDomainAvailible($domain)
       {
               //check, if a valid url is provided
               if(!filter_var($domain, FILTER_VALIDATE_URL))
               {
                       return false;
               }

               //initialize curl
               $curlInit = curl_init($domain);
               curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10);
               curl_setopt($curlInit,CURLOPT_HEADER,true);
               curl_setopt($curlInit,CURLOPT_NOBODY,true);
               curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true);

               //get answer
               $response = curl_exec($curlInit);

               curl_close($curlInit);

               if ($response) return true;

               return false;
       }
?&gt;
</pre>
<p>
	<strong>&rarr; Source: <a href="http://css-tricks.com/snippets/php/check-if-website-is-available/">http://css-tricks.com/snippets/php/check-if-website-is-available/</a></strong>
</p>
<h2>cURL replacement for file_get_contents()</h2>
<p>
	The<br />
	<code>file_get_contents()</code><br />
	function is very useful but it is unfortunely deactivated by default on some webhosts. Using cURL, we can write a replacement function that works exactly like<br />
	<code>file_get_contents()</code><br />
	.
</p>
<pre>
function file_get_contents_curl($url) {
	$ch = curl_init();

	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
	curl_setopt($ch, CURLOPT_URL, $url);

	$data = curl_exec($ch);
	curl_close($ch);

	return $data;
}
</pre>
<p>
	<strong>&rarr; Source: <a href="http://snipplr.com/view/4084">http://snipplr.com/view/4084</a></strong>
</p>
<h2>Get latest Twitter status</h2>
<p>
	Using PHP and cURL, it is pretty easy to get the status of a specific user. Once you have it, what about displaying it on your blog, like I do in <a href="http://www.wprecipes.com">WPRecipes</a> footer?
</p>
<pre class="brush: php">function get_status($twitter_id, $hyperlinks = true) {
    $c = curl_init();
    curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml?count=1");
    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    $src = curl_exec($c);
    curl_close($c);
    preg_match('/&lt;text&gt;(.*)&lt;\/text&gt;/', $src, $m);
    $status = htmlentities($m[1]);
    if( $hyperlinks ) $status = ereg_replace("[[:alpha:]]+://[^&lt;&gt;[:space:]]+[[:alnum:]/]", '&lt;a href="%5C%22%5C%5C0%5C%22"&gt;\\0&lt;/a&gt;', $status);
    return($status);
}</pre>
<p>The function is super easy to use:</p>
<pre>echo get_status('catswhocode');</pre>
<p>
	<strong>&rarr; Source: <a href="http://www.catswhocode.com/blog/php-snippets-to-interact-with-twitter">http://www.catswhocode.com/blog/php-snippets-to-interact-with-twitter</a></strong>
</p>
<h2>Twitter: test friendship between two users</h2>
<p>
	If you want to know if a specific user is following you (or someone else) you have to use the Twitter API. This snippet will echo<br />
	<code>true</code><br />
	if the two users specified on lines 18 and 19 are friends. It will return<br />
	<code>false</code><br />
	otherwise.
</p>
<pre>
function make_request($url) {
	$ch = curl_init();
	curl_setopt($ch,CURLOPT_URL,$url);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
	$result = curl_exec($ch);
	curl_close($ch);
	return $result;
}

/* gets the match */
function get_match($regex,$content) {
	preg_match($regex,$content,$matches);
	return $matches[1];
}

/* persons to test */
$person1 = 'phpsnippets';
$person2 = 'catswhocode';

/* send request to twitter */
$url = 'https://api.twitter.com/1/friendships/exist';
$format = 'xml';

/* check */
$persons12 = make_request($url.'.'.$format.'?user_a='.$person1.'&amp;user_b='.$person2);
$result = get_match('/&lt;friends&gt;(.*)&lt;\/friends&gt;/isU',$persons12);
echo $result; // returns "true" or "false"
</pre>
<p>
	<strong>&rarr; Source: <a href="http://www.catswhocode.com/blog/php-snippets-to-interact-with-twitter">http://www.catswhocode.com/blog/php-snippets-to-interact-with-twitter</a></strong>
</p>
<h2>Download and save images from a page using cURL</h2>
<p>Here is a set of functions that can be very useful: Give this script the url of a webpage, and it will save all images from this page on your server.</p>
<pre>
function getImages($html) {
    $matches = array();
    $regex = &#39;~http://somedomain.com/images/(.*?)\.jpg~i&#39;;
    preg_match_all($regex, $html, $matches);
    foreach ($matches[1] as $img) {
        saveImg($img);
    }
}

function saveImg($name) {
    $url = &#39;http://somedomain.com/images/&#39;.$name.&#39;.jpg&#39;;
    $data = get_data($url);
    file_put_contents(&#39;photos/&#39;.$name.&#39;.jpg&#39;, $data);
}

$i = 1;
$l = 101;

while ($i &lt; $l) {
    $html = get_data(&#39;http://somedomain.com/id/&#39;.$i.&#39;/&#39;);
    getImages($html);
    $i += 1;
}
</pre>
<p>
	<strong>&rarr; Source: <a href="http://stackoverflow.com/questions/7747875/grab-download-images-from-multiple-pages-using-php-preg-match-all-curl">http://stackoverflow.com/questions/7747875/grab-download-images-from-multiple-pages-using-php-preg-match-all-curl</a></strong>
</p>
<h2>Convert currencies using cURl and Google</h2>
<p>
	Converting currencies isn&#8217;t very hard to do, but as the currencies fluctuates all the time, we definitely need to use a service like Google to get the most recent values. The<br />
	<code>currency()</code><br />
	function take 3 parameters: from, to, and sum.
</p>
<pre>
function currency($from_Currency,$to_Currency,$amount) {
    $amount = urlencode($amount);
    $from_Currency = urlencode($from_Currency);
    $to_Currency = urlencode($to_Currency);
    $url = &quot;http://www.google.com/ig/calculator?hl=en&amp;q=$amount$from_Currency=?$to_Currency&quot;;
    $ch = curl_init();
    $timeout = 0;
    curl_setopt ($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch,  CURLOPT_USERAGENT , &quot;Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)&quot;);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $rawdata = curl_exec($ch);
    curl_close($ch);
    $data = explode(&#39;&quot;&#39;, $rawdata);
    $data = explode(&#39; &#39;, $data[&#39;3&#39;]);
    $var = $data[&#39;0&#39;];
    return round($var,2);
}
</pre>
<p>
	<strong>&rarr; Source: <a href="http://l33ts.org/forum/Thread-PHP-Convert-currencies-using-Google-and-cURL-Snippet">http://l33ts.org/forum/Thread-PHP-Convert-currencies-using-Google-and-cURL-Snippet</a></strong>
</p>
<h2>Get remote filesize using cURL</h2>
<p>Want to be able to calculate the size of a specific file? The following function can help. It takes 3 parameters: the file url, and in case the file is password protected, a username and a password.</p>
<pre>
function remote_filesize($url, $user = &quot;&quot;, $pw = &quot;&quot;){
    ob_start();
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_NOBODY, 1);

    if(!empty($user) &amp;&amp; !empty($pw))
    {
        $headers = array(&#39;Authorization: Basic &#39; .  base64_encode(&quot;$user:$pw&quot;));
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    }

    $ok = curl_exec($ch);
    curl_close($ch);
    $head = ob_get_contents();
    ob_end_clean();

    $regex = &#39;/Content-Length:\s([0-9].+?)\s/&#39;;
    $count = preg_match($regex, $head, $matches);

    return isset($matches[1]) ? $matches[1] : &quot;unknown&quot;;
}
</pre>
<p>
	<strong>&rarr; Source: <a href="http://megasnippets.com/source-codes/php/get_remote_filesize">http://megasnippets.com/source-codes/php/get_remote_filesize</a></strong>
</p>
<h2>FTP upload with cURL</h2>
<p>PHP does have a FTP library, but you can also use cURL to upload files on a FTP server. Here is a working example:</p>
<pre>
// open a file pointer
$file = fopen("/path/to/file", "r");

// the url contains most of the info needed
$url = "ftp://username:password@mydomain.com:21/path/to/new/file";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// upload related options
curl_setopt($ch, CURLOPT_UPLOAD, 1);
curl_setopt($ch, CURLOPT_INFILE, $fp);
curl_setopt($ch, CURLOPT_INFILESIZE, filesize("/path/to/file"));

// set for ASCII mode (e.g. text files)
curl_setopt($ch, CURLOPT_FTPASCII, 1);

$output = curl_exec($ch);
curl_close($ch);
</pre>
<img src="http://feeds.feedburner.com/~r/goksel/~4/G7fJ-d509o8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://geryit.com/blog/amazing-things-to-do-with-php-and-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://geryit.com/blog/amazing-things-to-do-with-php-and-curl/</feedburner:origLink></item>
		<item>
		<title>Developing a Responsive Website: The Footer</title>
		<link>http://feedproxy.google.com/~r/goksel/~3/RDuG8RA9p7w/</link>
		<comments>http://geryit.com/blog/developing-a-responsive-website-the-footer/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 11:17:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Css3]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Out-source]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://geryit.com/blog/?p=1313</guid>
		<description><![CDATA[At this point we’re just about done with the homepage of our responsive website. We’ve got our navigation in place, our background images resize nicely, and our other elements are able to resize and adjust to various screen resolutions. Today we’re going to focus on tying the page off with a footer. I’ve always admired [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>At this point we’re just about done with the homepage of our responsive website.  We’ve got our navigation in place, our background images resize nicely, and our other elements are able to resize and adjust to various screen resolutions.</p>
<p>Today we’re going to focus on tying the page off with a footer.  I’ve always admired sites that put some thought in to the bottom of their page design.  There are certainly times when a footer requires nothing more than some basic contact info and maybe a copyright claim.<span id="more-1473"></span></p>
<p>But I think it’s a good idea with any site requiring a fair amount of vertical scrolling to go ahead and add a smaller version of your main navigation in to your footer.  This allows the viewer to reach the end of your page and quickly jump to another page on the site.  We’ll put the icing on our footer by feeding in our latest tweet with a little jQuery script and then sprinkle in some contact info.  Before we dive in to it, let’s take a quick peek at what we’re working towards.</p>
<p><img class="aligncenter size-full wp-image-1474" src="http://www.developerdrive.com/wp-content/uploads/2012/01/footer.jpg" alt="" width="600" height="116" /></p>
<p>Much like a website&#8217;s header, I like to use a separate file for my footer and dynamically pull it in to each page with a php include.</p>
<p>This makes for quick and easy updating if a link is added or contact info changes.  Go ahead and open your idex.php file and include your footer, mine is sitting just above the close of my body tag and looks like this.</p>
<pre class="brush: html">&lt;footer&gt;
    	&lt;?php include('footer.php') ?&gt;
&lt;/footer&gt;</pre>
<p>That’s it for our index.php page, go ahead and save it then close out of that file.  Next up we’re going to want to create our footer file and enter all of our content, so open a new document and save it as “footer.php”.  The first tag we’re going to want to drop in our footer.php file is our container id.</p>
<p>This will keep our footer content centered on the page and aligned nicely with the rest of our main content above.  You’ll notice in the image of our footer above that it’s broken down in to three sections, so we’re going to want to include a “footerLeft” class right after we open the container.</p>
<p>We then populate our “footerLeft” class with a miniature version of our main navigation, and then icons linking to our social media pages.  At this point my code looks like this.</p>
<pre class="brush: html">&lt;div id="container"&gt;
	&lt;div class="footerLeft"&gt;
		&lt;ul&gt;
    		&lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;

        	&lt;li&gt;&lt;a href="#"&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
        	&lt;li&gt;&lt;a href="#"&gt;Services&lt;/a&gt;&lt;/li&gt;
        	&lt;li&gt;&lt;a href="#"&gt;About&lt;/a&gt;&lt;/li&gt;

        	&lt;li&gt;&lt;a href="#"&gt;Blog&lt;/a&gt;&lt;/li&gt;
        	&lt;li class="last"&gt;&lt;a href="#"&gt;Contact&lt;/a&gt;&lt;/li&gt;
    	&lt;/ul&gt;

        &lt;img src="images/blogger.png" /&gt;
        &lt;img src="images/linkedin.png" /&gt;
        &lt;img src="images/facebook_icon.png" /&gt;
        &lt;img src="images/twitter.png" /&gt;
	&lt;/div&gt;&lt;!--end div "footerLeft"--&gt;
&lt;/div&gt;&lt;!--end div “container”--&gt;</pre>
<p>Our middle section is our Twitter feed and is only three simple lines of code, an image wrapped in a div class I named “twitter”.  Our content is populated by jQuery and is set to recognize our “twitter” class as the appropriate location to place our latest tweet.  We’ll dive in to this in our next tutorial.</p>
<pre class="brush: html">&lt;div class="twitter"&gt;
    &lt;img src="images/twitter-preview.png" /&gt;
&lt;/div&gt;&lt;!--end div "twitter"--&gt;</pre>
<p>Lastly we have some contact info, which I aptly named “contact”.  From there simple paragraph and line break formatting displays our contact info.</p>
<pre class="brush: html">&lt;div class="contact"&gt;
    &lt;p&gt;Developer Drive&lt;br&gt;

	123 Fake St.&lt;br&gt;
	Cupertino, CA 95014&lt;br&gt;
	P: 650-555-1212&lt;br&gt;
	F: 650-555-1213&lt;/p&gt;
&lt;/div&gt;&lt;!--end div "contact"--&gt;</pre>
<p>That does it for our footer.php file.  Feel free to check your work against my full footer.php code or save your work and close out of this page.</p>
<pre class="brush: html">&lt;div id="container"&gt;
	&lt;div class="footerLeft"&gt;
		&lt;ul&gt;
    		&lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;

        	&lt;li&gt;&lt;a href="#"&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
        	&lt;li&gt;&lt;a href="#"&gt;Services&lt;/a&gt;&lt;/li&gt;
        	&lt;li&gt;&lt;a href="#"&gt;About&lt;/a&gt;&lt;/li&gt;

        	&lt;li&gt;&lt;a href="#"&gt;Blog&lt;/a&gt;&lt;/li&gt;
        	&lt;li class="last"&gt;&lt;a href="#"&gt;Contact&lt;/a&gt;&lt;/li&gt;
    	&lt;/ul&gt;

        &lt;img src="images/blogger.png" /&gt;
        &lt;img src="images/linkedin.png" /&gt;
        &lt;img src="images/facebook_icon.png" /&gt;
        &lt;img src="images/twitter.png" /&gt;
	&lt;/div&gt;&lt;!--end div "footerLeft"--&gt;

    &lt;div class="twitter"&gt;
    &lt;img src="images/twitter-preview.png" /&gt;
    &lt;/div&gt;&lt;!--end div "twitter"--&gt;

    &lt;div class="contact"&gt;
    &lt;p&gt;Developer Drive&lt;br&gt;

	123 Fake St.&lt;br&gt;
	Cupertino, CA 95014&lt;br&gt;
	P: 650-555-1212&lt;br&gt;
	F: 650-555-1213&lt;/p&gt;

    &lt;/div&gt;&lt;!--end div "contact"--&gt;
&lt;/div&gt;&lt;!--end div "container"--&gt;</pre>
<p>Now that all of the content is entered in to the appropriate files, we can begin to style it.  Our regular HTML5 footer tag sets the height, color, and font style for our footer.  I also put a thick top border to help separate our footer from our portfolio slider above.</p>
<pre class="brush: css">footer {
	height:250px;
	background-color:#C15007;
	border-top:10px solid #EDEAE5;
	color:#fff;
	font-weight:bold;
	font-weight:.8em;
}</pre>
<p>The .footerLeft class gets a little tricky as there’s quite a bit going on in there with our mini main navigation list elements and images.  Most of this is basic styling, but there are a couple things worth pointing out.</p>
<p>Since we don’t have too much room to make our mini navigation bar fluid and keep it on the same line with decent spacing, I made its width specific.  We’ll rely on the Twitter and contact sections for our minor width adjustments.</p>
<p>Also, it’s worth pointing out that the inline display under our list element is important to maintain the same horizontal appearance of our page links.</p>
<pre class="brush: css">.footerLeft {
	color:#fff;
	float:left;
	width:380px;
	height:150px;
	border-right:1px solid #fff;
	margin-top:5%;
	padding-top:2%;
}

.footerLeft ul li{
	display:inline;
	text-transform:uppercase;
	list-style:none;
	margin-right:2%;
}

.footerLeft ul li a {
	font-size:.8em;
	color:#fff;
	text-decoration:none;
	font-weight:bold;
}

.footerLeft ul li a:hover {
	text-decoration:underline;
}

.footerLeft img {
	float:right;
	margin:5% 2% 5% 0;
}</pre>
<p>Next up we have our Twitter section, notice how we’re back to a percentage based width.  We’re also able to style the time stamp of our tweets to subtly pronounce the time of our last tweet.</p>
<pre class="brush: css">.twitter {
	width: 35%;
	height:150px;
	float:left;
	margin-top:5%;
	padding:2% 2% 0 2%;
	border-right:1px solid #fff;
	color:#fff;
	font-weight:bold;
	font-weight:.8em;
}

.twitter img {
	float:left;
	margin-bottom:100px;
	margin-right:5%;
}

.twitter .tweet a {
	text-decoration: none;
	color:#6BA5BD;
	font-weight:bold;
	font-weight:.8em;
}

.twitter .tweet a:hover {
	text-decoration: underline;
}

.twitter .tweet .time {
	font-size:10px;
	font-style:italic;
	color:#FFD08C;
}</pre>
<p>Lastly, we’ll add some spacing to our contact section for an evenly spaced look.</p>
<pre class="brush: css">.contact {
	float:left;
	margin-top:5%;
	padding:2% 2% 0 2%;
}</pre>
<p>Next week we’ll finish off the styling to make our footer fully responsive as well as discuss the jQuery Twitter feed.  In the mean time, test your responsive skills and see if you’re able to make your footer responsive.  Click <a title="here" href="http://www.developerdrive.com/wp-content/uploads/2012/01/Footer-Part-1.zip" target="_blank">here</a> to download the source code.</p>
</p></div>
<img src="http://feeds.feedburner.com/~r/goksel/~4/RDuG8RA9p7w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://geryit.com/blog/developing-a-responsive-website-the-footer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<media:content url="http://feedproxy.google.com/~r/goksel/~5/d-5jUwiYRjQ/Footer-Part-1.zip" fileSize="851527" type="application/zip" /><itunes:explicit>no</itunes:explicit><itunes:subtitle>At this point we’re just about done with the homepage of our responsive website. We’ve got our navigation in place, our background images resize nicely, and our other elements are able to resize and adjust to various screen resolutions. Today we’re going </itunes:subtitle><itunes:summary>At this point we’re just about done with the homepage of our responsive website. We’ve got our navigation in place, our background images resize nicely, and our other elements are able to resize and adjust to various screen resolutions. Today we’re going to focus on tying the page off with a footer. I’ve always admired [...]</itunes:summary><itunes:keywords>Css3, Design, Development, Out-source, Tutorials</itunes:keywords><feedburner:origLink>http://geryit.com/blog/developing-a-responsive-website-the-footer/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/goksel/~5/d-5jUwiYRjQ/Footer-Part-1.zip" length="851527" type="application/zip" /><feedburner:origEnclosureLink>http://www.developerdrive.com/wp-content/uploads/2012/01/Footer-Part-1.zip</feedburner:origEnclosureLink></item>
		<item>
		<title>Implement Google Custom Search into WordPress [.net Magazine]</title>
		<link>http://feedproxy.google.com/~r/goksel/~3/J-rBzcGFxHQ/</link>
		<comments>http://geryit.com/blog/implement-google-custom-search-into-wordpress-net-magazine/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 11:39:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Out-source]]></category>
		<category><![CDATA[Seo]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://geryit.com/blog/?p=1302</guid>
		<description><![CDATA[Knowledge needed: Basic PHP, experience with WordPress Requires: WordPress 3.1+ Project time: 1 hour WordPress has a search function which has developers opinions split. Freelancer Paul Maloney shows us how to replace the search function with a super powered Google Custom Search engine View demo: http://netmag.clientden.com/ WordPress and its search function &#8211; this is a [...]]]></description>
			<content:encoded><![CDATA[<div class="content">
<div class="tutorial-details" >
<ul>
<li><strong>Knowledge needed</strong>: Basic PHP, experience with WordPress</li>
<li><strong>Requires</strong>: WordPress 3.1+</li>
<li><strong>Project time</strong>: 1 hour</li>
</ul>
<div class="clear-both" ></div>
</div>
<h2 class="strapline">
         WordPress has a search function which has developers opinions split. Freelancer Paul Maloney shows us how to replace the search function with a super powered Google Custom Search engine      </h2>
<div class="copy" >
<p><em>View demo: <a href="http://netmag.clientden.com/" rel="nofollow">http://netmag.clientden.com/</a></em></p>
<p>WordPress and its search function &ndash; this is a subject that often splits the most hardcore WordPress users. Terms like &ldquo;abysmal&rdquo; are frequently banded about among developers, I personally defend it&hellip; to a certain level.</p>
<p>For smaller sites the search function does its job successfully, it&rsquo;s no frills and does what it says on the tin, but for larger sites it can be like taking a spoon to a bazooka fight. So today I plan to show you how to integrate Google Custom Search into your WordPress install and harness the raw power of the world&rsquo;s most powerful search solution.</p>
<p>Before we get into the nitty gritty I wanted to briefly cover something that has come up as an issue (of sorts) for me while replacing the search function. As we all know Google Custom Search will use Google results for your site so we need to ensure Google has good access to our content, so installing the <a href="http://wordpress.org/extend/plugins/google-sitemap-generator/" rel="nofollow">Google XML Sitemap plugin</a> will assist in Google&rsquo;s indexing quest. The other point of note is due to the way WordPress archives work, Google may index multiple versions of your posts so you could in effect have several versions of the same article competing in your own search results, so to combat this I opted to use the <a href="http://wordpress.org/extend/plugins/all-in-one-seo-pack/" rel="nofollow">All In One SEO Pack plug-in</a> and set it up so only single posts would appear.</p>
<p>Not only will using these (or similar) plug-ins help your custom search work more efficiently; it&rsquo;s also good SEO practice and could help you climb up those pages!</p>
<p>Now we can move onto the part you have been patiently waiting for, the actual implementation of Google Custom Search into WordPress.</p>
<h4 class="advert_mpu_body_hdr">Advertisement</h4>
<p><script>
         var d = new Date();
         var ord = d.getFullYear()+''+d.getMonth()+''+d.getDay()+''+d.getMinutes()+''+d.getSeconds();
         var script = '<scr'+'ipt src="http://ad.doubleclick.net/adj/fut.gb.net/tutorials;kw=Search;kw=WordPress;tile=4;sz=300x250;pos=2;'+segQS+';gs_cat='+gs_channels+';ord='+ord+'?" ></scr'+'ipt>';
   document.write('
<div id="advert_mpu_body_1_source" class="advert_source" >'+script+'</div>
<p>');</script><noscript><a href="http://ad.doubleclick.net/jump/fut.gb.net/tutorials;kw=Search;kw=WordPress;tile=4;sz=300x250;ord=2012013104?" target="_blank"><img src="http://ad.doubleclick.net/ad/fut.gb.net/tutorials;kw=Search;kw=WordPress;tile=4;sz=300x250;pos=2;ord=2012013104?" width="300" height="250" alt=""></a></noscript></p>
<h2>Creating a custom search engine</h2>
<p>First thing first, we need to visit Google Custom Search and set up our search engine. Follow this link: <a href="http://www.google.com/cse/" rel="nofollow">http://www.google.com/cse/</a> and you will be taken to the Google Custom Search page were you can create or manage your search engines.</p>
<figure class="captioned-image" style="width:635px" ><img alt="" src="http://media.netmagazine.com/files/images/2012/1/custom_search_page_one.jpg" style="width:615px; height:486px" /></figure>
<p>We need to give our search engine a name, description and define its primary language, then we need to give it a list of sites to search, so in our case it would just be our site, so for example: <a href="http://www.netmagazine.com" title="http://www.netmagazine.com">http://www.netmagazine.com</a>.</p>
<p>You then need to select an edition, there is an ad supported free version or, for the more financially blessed among us, we can go for the paid version and wave goodbye to those ads.</p>
<figure class="captioned-image" style="width:635px" ><img alt="" src="http://media.netmagazine.com/files/images/2012/1/custom_search_page_two.jpg" style="width:615px; height:336px" /></figure>
<p>At this point Google Custom Search offers little in the way of customisation, but does offer a few themes and layouts we can use and hopefully one of those will work on our WordPress install.</p>
<figure class="captioned-image" style="width:635px" ><img alt="" src="http://media.netmagazine.com/files/images/2012/1/custom_search_page_three.jpg" style="width:615px; height:478px" /></figure>
<p>The final step over at Google is to grab our code for our custom search engine, Google recommends using a supported Doc Type such as<strong> &lt;!DOCTYPE html&gt;</strong> in your pages as the custom search uses some CSS hover effects.</p>
<p>Below our code Google also offers some further options that you can use to customise the custom search a little further, which in this case we will need to do.</p>
<figure class="captioned-image" style="width:635px" ><img alt="" src="http://media.netmagazine.com/files/images/2012/1/layout.jpg" style="width:615px; height:400px" /></figure>
<p>Hit the <strong>change the look and feel</strong> link and you will be presented with some layout and style options. We will need to use the <strong>Results only</strong> layout as we will be using our own search box. Tthe style is totally up to you. Once that is done, hit the <strong>Save &amp; Get Code</strong> button and we can then finish this part off by grabbing our code.</p>
<figure class="captioned-image" style="width:635px" ><img alt="" src="http://media.netmagazine.com/files/images/2012/1/get_code.jpg" style="width:615px; height:400px" /></figure>
<p>You will need to specify your site details such as HTTP/HTTPS and specify the search result details &ndash; we should use &ldquo;q&rdquo;, which is the default Google search query parameter.</p>
<p>Our code is now ready to use in our WordPress install, so keep it in a safe place for the time being.</p>
<h2>Building the results page</h2>
<p>To get the custom search in place of WordPress&rsquo; in built search function we are going to use a custom page template <em>(you can read more about these here: </em><a href="http://codex.wordpress.org/Pages#Page_Templates" rel="nofollow"><em>http://codex.wordpress.org/Pages#Page_Templates</em></a><em>).</em></p>
<p>At the beginning of a custom page template you must define your custom page name so it can be used by WordPress, so we will name our template <strong>googlesearch.php</strong> and place this at the top of our custom page:</p>
<div class="geshifilter">
<div class="php geshifilter-php">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/*</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">Template Name: Google Search</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">*/</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy1">?&gt;</span></div>
</li>
</ol>
</div>
</div>
<p>The file name and template name can of course be altered and named to anything you wish.</p>
<p>Once that is in place, you can continue to build the rest of your page. For this tutorial I will be using the TwentyEleven theme and using the <strong>page.php</strong> as a base to work from, which looks a little something like this:</p>
<div class="geshifilter">
<div class="php geshifilter-php">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co4">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co4">&nbsp;* The template for displaying all pages.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co4">&nbsp;*</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co4">&nbsp;* This is the template that displays all pages by default.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co4">&nbsp;* Please note that this is the WordPress construct of pages</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co4">&nbsp;* and that other &#8216;pages&#8217; on your WordPress site will use a</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co4">&nbsp;* different template.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co4">&nbsp;*</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co4">&nbsp;* @package WordPress</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co4">&nbsp;* @subpackage Twenty_Eleven</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co4">&nbsp;* @since Twenty Eleven 1.0</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co4">&nbsp;*/</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">get_header<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;primary&quot;&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;content&quot; role=&quot;main&quot;&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">&lt;?php</span> <span class="kw1">while</span> <span class="br0">&#40;</span> have_posts<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="sy0">:</span> the_post<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">&lt;?php</span> get_template_part<span class="br0">&#40;</span> <span class="st_h">&#8216;content&#8217;</span><span class="sy0">,</span> <span class="st_h">&#8216;page&#8217;</span> <span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">&lt;?php</span> comments_template<span class="br0">&#40;</span> <span class="st_h">&#8221;</span><span class="sy0">,</span> <span class="kw4">true</span> <span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">&lt;?php</span> <span class="kw1">endwhile</span><span class="sy0">;</span> <span class="co1">// end of the loop. ?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">&lt;/</span>div<span class="sy0">&gt;&lt;!&#8211;</span> <span class="co2">#content &#8211;&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">&lt;/</span>div<span class="sy0">&gt;&lt;!&#8211;</span> <span class="co2">#primary &#8211;&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span> get_footer<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span></div>
</li>
</ol>
</div>
</div>
<p>That gives us our base to work with, but we need to add the code from Google and remove the things we don&#39;t need from the standard page template.</p>
<p>We don&rsquo;t need the content or comments part so they can be removed, and then you can add your search code so you end up with something like this:</p>
<div class="geshifilter">
<div class="php geshifilter-php">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/*</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">Template Name: Google Search</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">*/</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy1">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span> get_header<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;primary&quot;&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;content&quot; role=&quot;main&quot;&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">&lt;?php</span> <span class="kw1">while</span> <span class="br0">&#40;</span> have_posts<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="sy0">:</span> the_post<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&lt;div id=&quot;cse&quot; style=&quot;width: 100%;&quot;&gt;Loading&lt;/div&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;script src=&quot;http://www.google.com/jsapi&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</div>
</li>
<li class="li1">
<div class="de1">&lt;script type=&quot;text/javascript&quot;&gt; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; function parseQueryFromUrl () {</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; var queryParamName = &quot;q&quot;;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; var search = window.location.search.substr(1);</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; var parts = search.split(&#8216;&amp;&#8217;);</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; for (var i = 0; i &lt; parts.length; i++) {</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; var keyvaluepair = parts[i].split(&#8216;=&#8217;);</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; if (decodeURIComponent(keyvaluepair[0]) == queryParamName) {</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; return decodeURIComponent(keyvaluepair[1].replace(/\+/g, &#8216; &#8216;));</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; }</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; }</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; return &#8221;;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; }</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; google.load(&#8216;search&#8217;, &#8217;1&#8242;, {language : &#8216;en&#8217;, style : google.loader.themes.MINIMALIST});</div>
</li>
<li class="li1">
<div class="de1">&nbsp; google.setOnLoadCallback(function() {</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; var customSearchControl = new google.search.CustomSearchControl(</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &#8217;005589967590277281119:fumk3dewodg&#8217;);</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; var options = new google.search.DrawOptions();</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; options.enableSearchResultsOnly(); </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; customSearchControl.draw(&#8216;cse&#8217;, options);</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; var queryFromUrl = parseQueryFromUrl();</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; if (queryFromUrl) {</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; customSearchControl.execute(queryFromUrl);</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; }</div>
</li>
<li class="li1">
<div class="de1">&nbsp; }, true);</div>
</li>
<li class="li1">
<div class="de1">&lt;/script&gt;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">&lt;?php</span> <span class="kw1">endwhile</span><span class="sy0">;</span> <span class="co1">// end of the loop. ?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">&lt;/</span>div<span class="sy0">&gt;&lt;!&#8211;</span> <span class="co2">#content &#8211;&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">&lt;/</span>div<span class="sy0">&gt;&lt;!&#8211;</span> <span class="co2">#primary &#8211;&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span> get_footer<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="sy1">?&gt;</span></div>
</li>
</ol>
</div>
</div>
<p>*Notice the code is used inside the loop (<a href="http://codex.wordpress.org/The_Loop" rel="nofollow">codex.wordpress.org/The_Loop</a>).</p>
<p>We can now upload that new file which I have called <strong>googlesearch.php</strong> to our theme folder.</p>
<h2>Creating the search page</h2>
<p>Now the bulk of the code is done we need to create a new page through the WordPress wp-admin, I have called my page &ldquo;Search Results.&rdquo;</p>
<figure class="captioned-image" style="width:635px" ><img alt="" src="http://media.netmagazine.com/files/images/2012/1/add_page.jpg" style="width:615px; height:350px" /></figure>
<p>You will see my page has no content as Google will supply that for us, but the main thing we need to do here is change the template to our custom page template. In this case we need to select the <strong>Google Search</strong> template from the drop down on the right. Once we have done that hit <strong>Publish</strong>.</p>
<figure class="captioned-image" style="width:635px" ><img alt="" src="http://media.netmagazine.com/files/images/2012/1/searchform.jpg" style="width:615px; height:303px" /></figure>
<p>We will also need to alter one other snippet of code. In <strong>searchform.php</strong> we need to alter the <strong>name</strong> field from <strong>s</strong> to <strong>q</strong>, and the form action to the URL of our new results page (in my demos case: <strong>action=&rdquo;<a href="http://netmag.clientden.com/search-results" rel="nofollow">http://netmag.clientden.com/search-results</a>&rdquo;</strong>). Once that has been changed we&#39;re ready to go.</p>
<h2>Tweaking our custom search engine</h2>
<p>If all goes well, we now have a custom search engine that displays our WordPress&rsquo; results on our search-results page.</p>
<figure class="captioned-image" style="width:635px" ><img alt="" src="http://media.netmagazine.com/files/images/2012/1/search_results.jpg" style="width:615px; height:350px" /></figure>
<p>You might notice when you hit a link from your results page, it opens in a new window which is not ideal, so if we want to change this, we can add an extra snippet to our <strong>googlesearch.php </strong>page:</p>
<p>If we add:</p>
<div class="geshifilter">
<div class="php geshifilter-php">
<ol>
<li class="li1">
<div class="de1">customSearchControl<span class="sy0">.</span>setLinkTarget<span class="br0">&#40;</span>google<span class="sy0">.</span>search<span class="sy0">.</span>Search<span class="sy0">.</span>LINK_TARGET_SELF<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
</div>
<p>between the following:</p>
<div class="geshifilter">
<div class="php geshifilter-php">
<ol>
<li class="li1">
<div class="de1">customSearchControl<span class="sy0">.</span>setResultSetSize<span class="br0">&#40;</span>google<span class="sy0">.</span>search<span class="sy0">.</span>Search<span class="sy0">.</span>FILTERED_CSE_RESULTSET<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">var</span> options <span class="sy0">=</span> <span class="kw2">new</span> google<span class="sy0">.</span>search<span class="sy0">.</span>DrawOptions<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
</div>
<p>so we get this:</p>
<div class="geshifilter">
<div class="php geshifilter-php">
<ol>
<li class="li1">
<div class="de1">customSearchControl<span class="sy0">.</span>setResultSetSize<span class="br0">&#40;</span>google<span class="sy0">.</span>search<span class="sy0">.</span>Search<span class="sy0">.</span>FILTERED_CSE_RESULTSET<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;customSearchControl<span class="sy0">.</span>setLinkTarget<span class="br0">&#40;</span>google<span class="sy0">.</span>search<span class="sy0">.</span>Search<span class="sy0">.</span>LINK_TARGET_SELF<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">var</span> options <span class="sy0">=</span> <span class="kw2">new</span> google<span class="sy0">.</span>search<span class="sy0">.</span>DrawOptions<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
</ol>
</div>
</div>
<p>Your search results will now open in the same window, which in most cases will be the desired result.</p>
<figure class="captioned-image" style="width:635px" ><img alt="" src="http://media.netmagazine.com/files/images/2012/1/new_window.jpg" style="width:615px; height:350px" /></figure>
<p>Google offers further steps for customisation, such as applying your own stylesheet and using image search with your results but I will allow you to dig into those in further depth at your leisure.</p>
<h2>Conclusion</h2>
<p>While this is a solution that will favour many, it does have a few downsides. New posts might take a few days to get indexed and results can change, so popular pages might rank higher than newer articles and so on&hellip; That being said if you are managing a content heavy site and the inbuilt search feature doesn&rsquo;t cut the mustard, this is probably right up your street.</p>
<div class="clear-both" ></div>
</p></div>
</p></div>
<img src="http://feeds.feedburner.com/~r/goksel/~4/J-rBzcGFxHQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://geryit.com/blog/implement-google-custom-search-into-wordpress-net-magazine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://geryit.com/blog/implement-google-custom-search-into-wordpress-net-magazine/</feedburner:origLink></item>
		<item>
		<title>Designing a Clean Website: Gradients [developerDrive]</title>
		<link>http://feedproxy.google.com/~r/goksel/~3/65rMGa9DpN8/</link>
		<comments>http://geryit.com/blog/designing-a-clean-website-gradients-developerdrive/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 23:55:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Css3]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Out-source]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://geryit.com/blog/?p=1295</guid>
		<description><![CDATA[This is our third installment of how to design a clean a minimalist website. First we looked at navigation and how to make an accordion style drop-down menu with pure CSS3. Then we moved on to laying the site out and went over rounding corners and applying drop shadows with CSS3. Now we’re going to [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>This is our third installment of how to design a clean a minimalist website.</p>
<p>First we looked at navigation and how to make an accordion style drop-down menu with pure CSS3. Then we moved on to laying the site out and went over rounding corners and applying drop shadows with CSS3.</p>
<p>
		Now we’re going to look at how to create a gradient with CSS3 and apply that to a few of the elements in our homepage.<span id="more-1099"></span>
	</p>
<p>We left off in part two after we pulled our header, navigation and main image in to our layout. Now that we have all those things in place let’s go ahead and put in a few small quick-info type boxes underneath our main image. You can populate these boxes with anything you want, news headlines that link to a blog or news page, images, ads, testimonials, you name it.</p>
<p>For this tutorial I’m just going to use a few of the most recent blog posts off Developer Drive. We’re going to use the &lt;article&gt; tag for these boxes and add a little bit of style to help polish them up. Three of the main style elements I’m going to use on these are rounded corners, drop shadows and gradients.</p>
<p>I styled an article tag with the class “home” and made it 248 px wide by 190 px tall so that they’d align nicely underneath our main image. I also added margins, padding and the rest of the styling as follows.</p>
<pre class="brush: js">article.home {
	float:left;
	width:248px;
	height:190px;
	padding:5px;
	margin:11px 11px 11px 0;
	border:1px solid #737373;
	-moz-border-radius:7px;
	border-radius:7px;
	-webkit-border-radius:7px;
	box-shadow: 2px 2px 2px #838383;
        overflow:hidden;
}</pre>
<p>Next we want to make it look a little less flat and dull and gradients are an excellent way to breathe a little bit of color in to a site and help give it that nice, glossy, modern look.</p>
<p>
		To make a gradient cross-browser compatible requires a lot of redundant coding, so that’s when a site like <a href="http://www.colorzilla.com/">Colorzilla</a> comes in handy. Colorzilla generates cross-browser gradient code for you with a few simple clicks of the mouse.
	</p>
<p>
		<a href="http://www.developerdrive.com/wp-content/uploads/2011/12/colorzilla.jpg"><img class="alignnone size-full wp-image-1100" src="http://www.developerdrive.com/wp-content/uploads/2011/12/colorzilla.jpg" alt="Colorzilla" width="600" height="500" /></a>
	</p>
<p>When making a gradient you set start and stop points for each color, as well as opacity. Adding a simple gradient to something like a navigation bar, or in our case to use as a background, can require a lot of repetitive coding.</p>
<p>Colorzilla makes this process a breeze, click the colors you want, slide the bars to where you want the colors to change, then highlight the automatically generated code and paste it in to your CSS file. You even get a real time preview of what your gradient will look like.</p>
<p>I created a gradient that was a soft grey color that faded to white and we’re going to have it start with the light grey at the bottom of the box and fade to white towards the top. I added the following code that Colorzilla generated for me to my article.home class in my CSS file.</p>
<pre class="brush: js">article.home {
	float:left;
	width:248px;
	height:190px;
	padding:5px;
	margin:11px 11px 11px 0;
	border:1px solid #737373;
	-moz-border-radius:7px;
	border-radius:7px;
	-webkit-border-radius:7px;
	box-shadow: 2px 2px 2px
        overflow:hidden;
        background: #ffffff; /* Old browsers */
        background: -moz-linear-gradient(top, #ffffff 79%, #dddddd 100%); /* FF3.6+ */
        background: -webkit-gradient(linear, left top, left bottom, color-stop(79%,#ffffff), color-stop(100%,#dddddd)); /* Chrome,Safari4+ */
        background: -webkit-linear-gradient(top, #ffffff 79%,#dddddd 100%); /* Chrome10+,Safari5.1+ */
        background: -o-linear-gradient(top, #ffffff 79%,#dddddd 100%); /* Opera 11.10+ */
        background: -ms-linear-gradient(top, #ffffff 79%,#dddddd 100%); /* IE10+ */
        background: linear-gradient(top, #ffffff 79%,#dddddd 100%); /* W3C */
}</pre>
<p>Since we’re going to be displaying some news headlines, let’s style a few other tags that will become useful. I’m going to use and h3 tag for the headline of each article, along with an h3 img tag so that we can include the author’s gravatar image as well.</p>
<p>I also created a h5 tag for the author’s name and the date and then styled a paragraph tag. These are all optional and could be unnecessary if you’re doing something different inside these boxes. When all was said and done my code ended up looking like this:</p>
<pre class="brush: js">article.home h3 {
	font-size:14px;
	margin:0;
	padding:0;
	color:#404648;
}

article.home h5 {
	font-size:10px;
	margin-bottom:0;
	padding-bottom:0;
	color:#404648;
}
article.home h3 img {
	float:left;
	margin-right:10px;
}
article.home p {
	border-top:3px solid #6BA5BD;
	font-size:12px;
	color:#737373;
	margin:0;
	padding-top:5px;
}</pre>
<p>Now that we’ve got all of the styling we need for our little promotional boxes under our main image, let’s jump back in to our index.php file and create the HTML needed and drop in the content.</p>
<p>Staying within the &lt;section&gt; tag, and just under the img src code for our main image, go ahead and place three instance of &lt;arcticle class=”home”&gt;. I just pulled some content out of a few recent Developer Drive articles, so my HTML ended up looking as follows.</p>
<pre class="brush: js">&lt;section&gt;
	&lt;img src="images/main.jpg" /&gt;

    &lt;article class="home"&gt;
    	&lt;h3&gt;&lt;img src="http://1.gravatar.com/avatar/5e4c689cf3621361f2c7ebe5b4eafbe0?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G" /&gt;Developing With The HTML5 Video Element&lt;/h3&gt;
        &lt;h5&gt;By Scott Stanton - November 23, 2011&lt;/h5&gt;
        &lt;p&gt;Videos have been a great way to attract viewers to a website long before YouTube launched back in 2005.  But it wasn't until the release of HTML5 that web developers have had a lightweight solution to playing the video.  In the past, displaying a video on your site meant your viewer was required to have a Flash or Java-based player installed on their system in order to watch the video.&lt;/p&gt;
    &lt;/article&gt;

    &lt;article class="home"&gt;
    	&lt;h3&gt;&lt;img src="http://0.gravatar.com/avatar/ad76000eb5dc4b306853179632d77400?s=40&amp;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G" /&gt;Creating a PHP User Survey: Writing to Database Tables&lt;/h3&gt;
        &lt;h5&gt;By Gerald Hanks - November 22, 2011&lt;/h5&gt;
        &lt;p&gt;In the first two parts of this series, we created the data layer that will hold the polling data and established methods for setting the variable values and reading from the database tables.&lt;br&gt;
In this part, we will build the methods that will write new polls and answers to the tables.
    &lt;/article&gt;
    &lt;article class="home"&gt;
    	&lt;h3&gt;&lt;img src="http://1.gravatar.com/avatar/b8eb0184e62e8a6e71a2d1d7be558248?s=40&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D40&amp;r=G" /&gt;An Introduction to HTML5's Video API Part 2&lt;/h3&gt;
        &lt;h5&gt;By Louis Lazaris - November 21, 2011&lt;/h5&gt;
        &lt;p&gt;This is the second part in our introduction to HTML5′s video API. In part 1 of this series, I introduced you to the basic markup we'll be using to play the video, then I helped set up a simple script with which we were able to make the controls visible, while ensuring that the native controls will still be visible when JavaScript is disabled.&lt;/p&gt;
    &lt;/article&gt;

&lt;/section&gt;</pre>
<p>Now that we’ve got our boxes and everything in place on our homepage we can utilize another cool new HTML5 tag, &lt;footer&gt;. I kept mine simple and just included some basic info that was wrapped in a &lt;p&gt; tag. Note how I take advantage of the php file and use a tiny snippet of code to dynamically generate the year.</p>
<pre class="brush: js">&lt;footer&gt;
	&lt;p&gt;All Content © Developer Drive &lt;?php echo date ('Y') ?&gt;&lt;/p&gt;
&lt;/footer&gt;</pre>
<p>I gave it some real basic styling back in my CSS file, the only real noteworthy bit being the border-top that helps separate the footer from the rest of the content. My footer styling looks like this.</p>
<pre class="brush: js">footer {
	position:absolute;
	top:747px;
	border-top:1px solid #838383;
	width:805px;
	text-align:center;
	margin-left:105px;
}
footer p {
	font-size:10px;
}</pre>
<p>Now you&#8217;ve got a basic homepage that is clean, simple, polished, and minimalist. You can leave it the way that it is and run with it, or supercharge it by turning your image in to a slider that cycles through several images.</p>
<p>Stay tuned next time where we will cover sub-pages and how to easily display content in a manner that will quickly load and not require the viewer to load a new page on each link they click.</p>
</div>
<img src="http://feeds.feedburner.com/~r/goksel/~4/65rMGa9DpN8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://geryit.com/blog/designing-a-clean-website-gradients-developerdrive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://geryit.com/blog/designing-a-clean-website-gradients-developerdrive/</feedburner:origLink></item>
		<item>
		<title>Adventures In The Third Dimension: CSS 3D Transforms [smashingmag]</title>
		<link>http://feedproxy.google.com/~r/goksel/~3/jlcUipEDC3A/</link>
		<comments>http://geryit.com/blog/adventures-in-the-third-dimension/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 23:30:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Css3]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Out-source]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://geryit.com/blog/?p=1287</guid>
		<description><![CDATA[Back in 2009, the WebKit development team proposed a new extension to CSS that would allow Web page elements to be displayed and transformed on a three-dimensional plane. This proposal was called 3D Transforms, and it was soon implemented in Safari for Mac and iOS. About a year later, support followed for Chrome, and early [...]]]></description>
			<content:encoded><![CDATA[<p>
	Back in 2009, the WebKit development team proposed a new extension to CSS that would allow Web page elements to be displayed and transformed on a three-dimensional plane. This proposal was called <strong>3D Transforms</strong>, and it was soon implemented in Safari for Mac and iOS. About a year later, support followed for Chrome, and early in 2011, for Android. Outside of WebKit, however, none of the other browser makers seemed to show much enthusiasm for it, so it’s remained a fairly niche and underused feature.
</p>
<p>That’s set to change, though, as the Firefox and Internet Explorer teams have decided to join the party by implementing 3D Transforms in pre-release versions of their browsers. So, if all goes according to plan, we’ll see them in IE 10 and a near-future version of Firefox (possibly 10 or 11, but that’s not confirmed yet), both of which are slated for release sometime this year.</p>
<p>That being the case, this is an ideal time to get ahead of the curve and start learning about the possibilities and potential of adding an extra dimension to your Web pages. This article aims to help you do just that, by taking you on a flying tour of the 3D Transforms syntax.</p>
<p>
	Please bear in mind that in order to see the examples in this article, you’ll need a browser that supports 3D Transforms; as I write this, that’s Safari, Chrome, <a href="http://ie.microsoft.com/testdrive/Info/Downloads/Default.html">IE 10 Platform Preview</a> or <a href="http://www.mozilla.org/firefox/channel/">Firefox Aurora</a>.
</p>
<div id="textadtarget"></div>
<h3>The Third Dimension</h3>
<p>On the Web, we’re accustomed to working in two dimensions: all elements have width and height, and we move them around the screen horizontally (left to right) and vertically (top to bottom). The move to a third dimension can be thought of as adding depth to elements, and adding movement towards and away from you (the viewer). Think about 3D films in which objects are constantly thrust out of the screen towards you in an attempt to demonstrate the possibilities of the extra depth.</p>
<p>To use 3D Transforms in CSS, you’ll need to know about axes (that’s the plural of axis, not the plural of axe). If you already know about working in three dimensions or remember using axes in math class at school, you can skip the next section. For everyone else, here is…</p>
<h3>A Quick Primer On Axes</h3>
<p>
	I just mentioned that on the 2-D Web, we move elements around horizontally and vertically. Each of these directions is called an axis: the horizontal line is known as the <strong>x-axis</strong>, and the vertical line is the <strong>y-axis</strong>. If we think of the top-left corner of an element as our origin (i.e. the point from which movement is measured), a movement to the left is a negative movement along the x-axis, and a move to the right is a positive movement along the x-axis. The same goes for moving an element up (negative on the y-axis) and down (positive on the y-axis).
</p>
<p>
	The third dimension is known as the <strong>z-axis</strong> and, as I said, can be thought of as towards or away from you; a negative movement along the z-axis is away from you, and a positive movement is towards you.
</p>
<p>
	<img src="http://coding.smashingmagazine.com/wp-content/uploads/2011/11/dimensions.jpg" alt="screenshot" width="400" height="270" /><br /> <em>Showing the three axes: x (left-right), y (up-down) and z (away-towards).</em>
</p>
<p>If you’ve read all of this talk of axes and negative movements and you’re rubbing your eyes and blinking in disbelief and misunderstanding, don’t worry: it will all become clear when you get stuck in the code. Come back and read this again after a few examples and it should all be clear.</p>
<h3>Transformation Functions</h3>
<p>
	The various transformations are all applied with a single CSS property:<br />
	<code>transform</code><br />
	— yes, the same property that’s used for 2-D CSS Transforms. At the moment, this property is still considered experimental, so remember to use all of the browser prefixes, like so:
</p>
<pre>div {
  -moz-transform: foo;
  -ms-transform: foo;
  -o-transform: foo;
  -webkit-transform: foo;
}</pre>
<p>Note that Opera doesn’t currently have an implementation of 3D Transforms, but I’m including it here because work is apparently underway. For the sake of clarity, in the examples throughout this article, I’ll use only non-prefixed properties, but remember to include all of the prefixed ones in your own code.</p>
<p>
	Anyway, the<br />
	<code>transform</code><br />
	property accepts a range of functions as values, each of which applies a different transformation. If you’ve used 2-D CSS Transforms, then you’ll already know many of these functions because they are quite similar (or, in some cases, the same). Here are all of the 3D functions:
</p>
<ul>
<li><code>matrix3d</code></li>
<li><code>perspective</code></li>
<li><code>rotateX</code>, <code>rotateY</code>, <code>rotateZ</code>, <code>rotate3d</code></li>
<li><code>scaleX</code>, <code>scaleY</code>, <code>scaleZ</code>, <code>scale3d</code></li>
<li><code>translateX</code>, <code>translateY</code>, <code>translateZ</code>, <code>translate3d</code></li>
</ul>
<p>
	Now,<br />
	<code>matrix3d</code><br />
	definitely sounds the coolest, but it’s so unbelievably complex (it takes 16 values!) that there’s no way I could cover it in this article. So, let’s put that aside and take a quick look at the others.
</p>
<h4>Rotation</h4>
<p>
	To explain what this does, I’ll have to ask you to do a little mental exercise (which will come in useful later in the article, too). Imagine a sheet of card with a string running through the middle that fixes it in place. By taking the top corners in your fingers, you can move the card up and down, left and right, and forwards and backwards, pivoting around the string. This is what the<br />
	<code>rotate()</code><br />
	function does. The individual functions<br />
	<code>rotateX()</code><br />
	,<br />
	<code>rotateY()</code><br />
	and<br />
	<code>rotateZ()</code><br />
	take a<br />
	<code>deg</code><br />
	(i.e. degree) value and move the element around its point of origin (where the string passes through it) by that much.
</p>
<p>
	Have a look at <a href="http://provide.smashingmagazine.com/smashingmag-3d/example1.html">our first example</a> (a screenshot is shown below in case you don’t have access to a supported browser). Here we’ve rotated each of the elements 45° around a different axis (in order: x, y, z), so you can see the effect of each. The semi-translucent red box shows the original position of the element, and if you mouse over each, you’ll see the transformations removed (I’ve used this convention in all of the examples in this article).
</p>
<p>
	<a href="http://provide.smashingmagazine.com/smashingmag-3d/example1.html"><img src="http://coding.smashingmagazine.com/wp-content/uploads/2011/11/example1.jpg" alt="screenshot" width="500" /></a><br /> <em>Each element is rotated 45° around a different axis: x (left), y (center) and z (right).</em>
</p>
<p>
	There is a<br />
	<code>rotate3d()</code><br />
	function as well, but it’s too complex to explain in a brief article like this one, so we’ll skip it.
</p>
<h4>Translation</h4>
<p>
	This is really just a fancy way of saying “movement.” The functions<br />
	<code>translateX()</code><br />
	,<br />
	<code>translateY()</code><br />
	and<br />
	<code>translateZ()</code><br />
	each take a length value, which moves the element by that distance along the given axis. So,<br />
	<code>translateX(2em)</code><br />
	would move the element 2 ems to the right, and<br />
	<code>translateZ(-10px)</code><br />
	would move the element 10 pixels away from the viewer. There’s also a shorthand function,<br />
	<code>translate3d()</code><br />
	, which takes three values in order, one for each axis, like so:<br />
	<code>translate3d(x, y, z)</code><br />
	.
</p>
<p>
	In <a href="http://provide.smashingmagazine.com/smashingmag-3d/example2.html">our second example</a>, we’ve translated each of the elements by -20 pixels along a different axis (in order: x, y, z).
</p>
<p>
	<a href="http://provide.smashingmagazine.com/smashingmag-3d/example2.html"><img src="http://coding.smashingmagazine.com/wp-content/uploads/2011/11/example2.jpg" alt="screenshot" width="500" /></a><br /> <em>Each element is translated by -20 pixels along a different axis: x (left), y (center) and z (right).</em>
</p>
<p>
	Note that translation of an element is similar to relative positioning, in that it doesn’t affect the document’s flow. The translated element will keep its position in the flow and will only <em>appear</em> to have moved, meaning it might cover or show through surrounding elements.
</p>
<h4>Scaling</h4>
<p>
	This just means making bigger or smaller. The three functions<br />
	<code>scaleX()</code><br />
	,<br />
	<code>scaleY()</code><br />
	and<br />
	<code>scaleZ()</code><br />
	each take a unitless number value, which is used as a multiplier. For<br />
	<code>scaleX()</code><br />
	and<br />
	<code>scaleY()</code><br />
	, this is applied directly to the width and height; for example, applying<br />
	<code>scaleY(1.5)</code><br />
	to an element with a height of 100 pixels would transform it to 150 pixels high, and applying<br />
	<code>scaleX(0.75)</code><br />
	to an element with a width of 100 pixels would transform it to 75 pixels wide.
</p>
<p>
	The<br />
	<code>scaleZ()</code><br />
	function behaves slightly differently. Transformed elements don’t actually have any depth to increase or decrease; what we’re doing is more like moving a 2-D object around in 3D space. Instead, the value given to<br />
	<code>scaleZ()</code><br />
	acts as a multiplier for the<br />
	<code>translateZ()</code><br />
	function that I explained in the last section. So, applying both<br />
	<code>translateZ(10px)</code><br />
	and<br />
	<code>scaleZ(2)</code><br />
	would translate an element 20 pixels along the z-axis.
</p>
<p>
	There’s also a shorthand property,<br />
	<code>scale3d()</code><br />
	, which, like<br />
	<code>translate3d()</code><br />
	, takes three values, one for each of the individual functions:<br />
	<code>scale3d(x,y,z)</code><br />
	. So, in the following code example, the same transformation applies to both of the elements:
</p>
<pre>.e1 {
   transform: scaleX(1.5) scaleY(1.5) scaleZ(0.75);
}

.e2 {
   transform: scale3d(1.5,1.5,0.75);
}</pre>
<h4>Perspective</h4>
<p>
	The<br />
	<code>perspective()</code><br />
	function is quite simple, but what it actually does is quite complex. The function takes a single value, which is a length unit greater than 0 (zero). Explaining this is a little complicated; the length is like a distance between you and the object that you’re viewing (a <a href="http://www.eleqtriq.com/2010/05/understanding-css-3d-transforms/">tutorial on Eleqtriq</a> has a more technical explanation and diagram). For our purposes, you just need to know that the lower the number, the more extreme the 3D effect will appear; any value below 200px, for example, will make the transformation appear very exaggerated, and any value of 1000px or more will seem to have no effect at all.
</p>
<p>
	In <a href="http://provide.smashingmagazine.com/smashingmag-3d/example3.html">our third example</a>, we have three transformed elements, each with a different value for the<br />
	<code>perspective()</code><br />
	function: 25px, 50px and 200px, respectively. Although the difference between the three is very discernible, it’s even clearer when you mouse over to see the transformations removed.
</p>
<p>
	<a href="http://provide.smashingmagazine.com/smashingmag-3d/example3.html"><img src="http://coding.smashingmagazine.com/wp-content/uploads/2011/11/example3.jpg" alt="screenshot" width="500" /></a><br /> <em>Each element has a different value for the <code>perspective()</code> function: 25px (left), 50px (center) and 200px (right).<br />
	</em>
</p>
<p>Note that I’ve transformed the parent elements (equally) so that we can see the degree of perspective more clearly; sometimes the difference in perspective values can be imperceptible.</p>
<h3>Other Properties</h3>
<p>
	In addition to<br />
	<code>transform</code><br />
	, you’ll need to know about a few other important properties.
</p>
<h4>transform-style</h4>
<p>
	If you’ll be applying 3D transformations to the children of an already transformed element, then you’ll need to use this property with the value<br />
	<code>preserve-3d</code><br />
	(the alternative, and default, is<br />
	<code>flat</code><br />
	). This means that the child elements will appear on their own planes; without it, they would appear flat in front of their parent.
</p>
<p>
	<a href="http://provide.smashingmagazine.com/smashingmag-3d/example4.html">Our fourth example</a> clearly illustrates the difference; the element on the left has the<br />
	<code>flat</code><br />
	value, and on the right,<br />
	<code>preserve-3d</code><br />
	.
</p>
<p>
	<a href="http://provide.smashingmagazine.com/smashingmag-3d/example4.html"><img class="alignnone size-full wp-image-116007" src="http://coding.smashingmagazine.com/wp-content/uploads/2011/11/example4.jpg" alt="screenshot" width="330" height="220" /></a><br /> <em>The element on the left has a <code>transform-style</code> value of <code>flat</code>, and the one on the right has a value of <code>preserve-3d</code>.<br />
	</em>
</p>
<p>
	Something else to note is that if you are transforming child elements, the parent must not have an<br />
	<code>overflow</code><br />
	value of<br />
	<code>hidden</code><br />
	; this would also force the children into appearing on the same plane.
</p>
<h4>transform-origin</h4>
<p>
	As mentioned, when you apply a transformation to an element, the change is applied around a point directly in the horizontal and vertical middle — like the imaginary piece of string we saw in the earlier illustration. Using<br />
	<code>transform-origin</code><br />
	, you can change this to any point in the element. Acceptable values are pairs of lengths, percentages or positional keywords (<br />
	<code>top</code><br />
	,<br />
	<code>right</code><br />
	, etc.). For example:
</p>
<pre>div {
   transform-origin: right top;
}</pre>
<p>
	In <a href="http://provide.smashingmagazine.com/smashingmag-3d/example5.html">our fifth example</a>, you can see the same transformations applied to two elements, each of which has a different<br />
	<code>transform-origin</code><br />
	value.
</p>
<p>
	<a href="http://provide.smashingmagazine.com/smashingmag-3d/example5.html"><img class="alignnone size-full wp-image-116007" src="http://coding.smashingmagazine.com/wp-content/uploads/2011/11/example5.jpg" alt="screenshot" width="355" height="215" /></a><br /> <em>The element on the left has a <code>transform-origin</code> value of <code>center center</code>, and the one on the right has a value of <code>right top</code>.<br />
	</em>
</p>
<p>The difference is clearly visible, but even more obvious if you pass the mouse over to see the transformation removed.</p>
<h4>backface-visibility</h4>
<p>
	Depending on which transformation functions you apply, sometimes you will move an element around until its front (or “face”) is angled away from you. When this happens, the default behavior is for the element to be shown in reverse; but if you use<br />
	<code>backface-visibility</code><br />
	with a value of<br />
	<code>hidden</code><br />
	, you’ll see nothing instead, not even a background color.
</p>
<h4>perspective and perspective-origin</h4>
<p>
	We introduced the<br />
	<code>perspective()</code><br />
	function earlier, but the<br />
	<code>perspective</code><br />
	property takes the same values; the difference is that the property applies only to the children of the element that it’s used on, not the element itself.
</p>
<p>
	The<br />
	<code>perspective-origin</code><br />
	property changes the angle from which you view the element that’s being transformed. Like<br />
	<code>transform-origin</code><br />
	, it accepts lengths, percentages or positional keywords, and the default position is the horizontal and vertical middle. The effect of changing the origin will be more pronounced the lower the<br />
	<code>perspective</code><br />
	value is.
</p>
<h3>Conclusion</h3>
<p>
	By necessity, we’ve flown through the intricacies of the 3D transformations syntax, but hopefully I’ve whetted your appetite to try it out yourself. With a certain amount of care for older browser versions, you can implement these properties in your own designs right now. If you don’t believe me, compare the list of “More adventures” on <a href="http://thefeed.orange.co.uk/">The Feed</a> website that I built last year in a browser that supports 3D transforms and in one that doesn’t, and you’ll see what I mean.
</p>
<p>
	Some of the concepts used in 3D transforms can be quite daunting, but experimentation will soon make them clear to you in practice, so get ahold of a browser that supports them and start making some cool stuff. But please, be responsible: not <em>everything</em> on the Web needs to be in three dimensions!</p>
<img src="http://feeds.feedburner.com/~r/goksel/~4/jlcUipEDC3A" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://geryit.com/blog/adventures-in-the-third-dimension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://geryit.com/blog/adventures-in-the-third-dimension/</feedburner:origLink></item>
		<item>
		<title>(Better) Tabs with Round Out Borders [by Chris Coyier]</title>
		<link>http://feedproxy.google.com/~r/goksel/~3/FI_Z8Fjktyc/</link>
		<comments>http://geryit.com/blog/better-tabs-with-round-out-borders-by-chris-coyier/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 21:24:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Css3]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Out-source]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://geryit.com/blog/?p=1280</guid>
		<description><![CDATA[The following is a guest post by Menno van Slooten. You might notice we&#8217;ve been down this road before, but I quite like Menno&#8217;s approach here. The end result proves you can get a little fancier with the design than I originally did, with borders, gradients, and shadows and while actually using less elements. A [...]]]></description>
			<content:encoded><![CDATA[<div class="explanation">
		The following is a guest post by <a href="http://www.mennovanslooten.nl/">Menno van Slooten</a>. You might notice we&#8217;ve been <a href="http://css-tricks.com/tabs-with-round-out-borders/">down this road before</a>, but I quite like Menno&#8217;s approach here. The end result proves you can get a little fancier with the design than I originally did, with borders, gradients, and shadows and while actually using less elements.
	</div>
<p>
		<img src="http://cdn.css-tricks.com/wp-content/uploads/2012/01/article-illustration-1.png" alt="" width="200" height="200" class="alignright size-full wp-image-15940">
	</p>
<p>
		A good-looking tab control usually has one feature that I&#8217;ve always found impossible to reproduce without images: borders that bend to the <em>outside</em> at the bottom of each tab. In this article I would like to show how you can use the CSS<br />
		<code>:before</code><br />
		and<br />
		<code>:after</code><br />
		pseudo elements to create this effect without using images. First, let&#8217;s start with some basic markup.
	</p>
<h3>The markup</h3>
<pre rel="HTML">
									<code>&lt;ul class="tabrow"&gt;
    &lt;li&gt;Lorem&lt;/li&gt;
    &lt;li&gt;Ipsum&lt;/li&gt;
    &lt;li class="selected"&gt;Sit amet&lt;/li&gt;
    &lt;li&gt;Consectetur adipisicing&lt;/li&gt;
&lt;/ul&gt;</code>
								</pre>
<p>This would be about as basic as you can get. Not a lot of elements to work with here, but it will do.</p>
<h3>Getting started</h3>
<p>
		To get started, let&#8217;s get rid of the default<br />
		<code>&lt;ul&gt;</code><br />
		and<br />
		<code>&lt;li&gt;</code><br />
		styling and get these babies in line.
	</p>
<div id="example-1" class="example">
<ul class="tabrow">
<li>Lorem</li>
<li>Ipsum</li>
<li class="selected">Sit amet</li>
<li>Consectetur adipisicing</li>
</ul></div>
<pre rel="CSS">
									<code>.tabrow {
    text-align: center;
    list-style: none;
    margin: 0;
    padding: 0;
    line-height: 24px;
}
.tabrow li {
    margin: 0 10px;
    padding: 0 10px;
    border: 1px solid #AAA;
    background: #ECECEC;
    display: inline-block;
}</code>
								</pre>
<h3>Selecting a tab</h3>
<p>The selected tab should of course be clearly visible.</p>
<div id="example-2" class="example">
<ul class="tabrow">
<li>Lorem</li>
<li>Ipsum</li>
<li class="selected">Sit amet</li>
<li>Consectetur adipisicing</li>
</ul></div>
<pre rel="CSS">
									<code>.tabrow li.selected {
    background: #FFF;
    color: #000;
}</code>
								</pre>
<h3>Getting to the bottom of things</h3>
<p>Every tab control needs a well-defined bottom edge. It won&#8217;t do much now, but later it will help emphasize the effect of the selected tab being on top.</p>
<div id="example-3" class="example">
<ul class="tabrow">
<li>Lorem</li>
<li>Ipsum</li>
<li class="selected">Sit amet</li>
<li>Consectetur adipisicing</li>
</ul></div>
<pre rel="CSS">
									<code>.tabrow {
    position: relative;
}
.tabrow:after {
    position: absolute;
    content: "";
    width: 100%;
    bottom: 0;
    left: 0;
    border-bottom: 1px solid #AAA;
    z-index: 1;
}</code>
								</pre>
<p>
		Here we introduced our first<br />
		<code>:after</code><br />
		pseudo-element. Basically,<br />
		<code>:after</code><br />
		appends another child to an element. It&#8217;s not in the DOM (which is why it&#8217;s called a <em>pseudo</em> element), so it is not a real child but it is completely stylable, as long as you add some<br />
		<code>content</code><br />
		, in this case a single space character.
	</p>
<p>
		In my opinion, the terms<br />
		<code>:before</code><br />
		and<br />
		<code>:after</code><br />
		are slightly confusing since the pseudo&#8217;s aren&#8217;t actually added before or after the element they apply to, but are inserted as children. This is also why you can&#8217;t apply<br />
		<code>:before</code><br />
		and<br />
		<code>:after</code><br />
		to elements that can&#8217;t contain children (&#8220;no content&#8221; elements), like<br />
		<code>&lt;input&gt;</code><br />
		.
	</p>
<p>
		In this case, we use the pseudo element to create a bottom border that doesn&#8217;t influence the tabs&#8217; positioning. We could have just put a bottom border on the<br />
		<code>&lt;ul&gt;</code><br />
		but that would&#8217;ve made the next step a little trickier.
	</p>
<h3>Above and beyond</h3>
<p>
		Now, an essential part of a convincing looking tab control, is that the selected tab sits <em>in front of</em> the edge while the rest fall behind the edge. To do this, we change its bottom border and do some<br />
		<code>z-index</code><br />
		magic.
	</p>
<div id="example-4" class="example">
<ul class="tabrow">
<li>Lorem</li>
<li>Ipsum</li>
<li class="selected">Sit amet</li>
<li>Consectetur adipisicing</li>
</ul></div>
<pre rel="CSS">
									<code>.tabrow:before {
    z-index: 1;
}
.tabrow li {
    position: relative;
    z-index: 0;
}
.tabrow li.selected {
    z-index: 2;
    border-bottom-color: #FFF;
}</code>
								</pre>
<h3>Around the bends</h3>
<p>
		It is now time to add the elusive border that bends to the outside and we&#8217;ll use<br />
		<code>:before</code><br />
		and<br />
		<code>:after</code><br />
		for this. Let&#8217;s take this step by step and first just put everything in position.
	</p>
<div id="example-5" class="example">
<ul class="tabrow">
<li>Lorem</li>
<li>Ipsum</li>
<li class="selected">Sit amet</li>
<li>Consectetur adipisicing</li>
</ul></div>
<pre rel="CSS">
									<code>.tabrow li:before,
.tabrow li:after {
    position: absolute;
    bottom: -1px;
    width: 6px;
    height: 6px;
    content: " ";
}
.tabrow li:before {
    left: -6px;
}
.tabrow li:after {
    right: -6px;
}
.tabrow li:after, .tabrow li:before {
    border: 1px solid #AAA;
}</code>
								</pre>
<h3>Don&#8217;t be such a square</h3>
<p>You can probably see where this is going. Let&#8217;s remove the borders we don&#8217;t want and add some rounded corners.</p>
<div id="example-6" class="example">
<ul class="tabrow">
<li>Lorem</li>
<li>Ipsum</li>
<li class="selected">Sit amet</li>
<li>Consectetur adipisicing</li>
</ul></div>
<pre rel="CSS">
									<code>.tabrow li {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}
.tabrow li:before {
    border-bottom-right-radius: 6px;
    border-width: 0 1px 1px 0;
}
.tabrow li:after {
    border-bottom-left-radius: 6px;
    border-width: 0 0 1px 1px;
}</code>
								</pre>
<h3>Cutting corners</h3>
<p>
		<img src="http://cdn.css-tricks.com/wp-content/uploads/2012/01/article-illustration-2.png" alt="" width="200" height="104" class="alignright size-full wp-image-15952">
	</p>
<p>There&#8217;s something not quite right about this result. Let&#8217;s look at it up close. As you can see both the original straight corner as well as the rounded corner are visible. We need to somehow get rid of the straight corner. To do that, we will cover it up with a shadow. To illustrate what&#8217;s going on, let&#8217;s make the shadow stand out a little bit.</p>
<div id="example-7" class="example">
<ul class="tabrow">
<li>Lorem</li>
<li>Ipsum</li>
<li class="selected">Sit amet</li>
<li>Consectetur adipisicing</li>
</ul></div>
<pre rel="CSS">
									<code>.tabrow li:before {
    box-shadow: 2px 2px 0 red;
}
.tabrow li:after {
    box-shadow: -2px 2px 0 red;
}</code>
								</pre>
<h3>Almost there</h3>
<p>
		<img src="http://cdn.css-tricks.com/wp-content/uploads/2012/01/article-illustration-3.png" alt="" width="200" height="104" class="alignright size-full wp-image-15953">
	</p>
<p>As you can see, the red shadows completely cover up the square corners we would like to hide. If we give the shadow the correct colors the illusion is complete.</p>
<div id="example-8" class="example">
<ul class="tabrow">
<li>Lorem</li>
<li>Ipsum</li>
<li class="selected">Sit amet</li>
<li>Consectetur adipisicing</li>
</ul></div>
<pre rel="CSS">
									<code>.tabrow li:before {
    box-shadow: 2px 2px 0 #ECECEC;
}
.tabrow li:after {
    box-shadow: -2px 2px 0 #ECECEC;
}
.tabrow li.selected:before {
    box-shadow: 2px 2px 0 #FFF;
}
.tabrow li.selected:after {
    box-shadow: -2px 2px 0 #FFF;
}</code>
								</pre>
<h3>Pieces of flair</h3>
<p>All that&#8217;s left to do now is adding a sprinkling of gradients and shadows to spice it up just a little bit.</p>
<div id="example-9" class="example">
<ul class="tabrow">
<li>Lorem</li>
<li>Ipsum</li>
<li class="selected">Sit amet</li>
<li>Consectetur adipisicing</li>
</ul></div>
<pre rel="CSS">
									<code>.tabrow li {
    background:      -o-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background:     -ms-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background:    -moz-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: -webkit-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    background: linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
    box-shadow: 0 3px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 #FFF;
    text-shadow: 0 1px #FFF;
    margin: 0 -5px;
    padding: 0 20px;
}</code>
								</pre>
<p>
		If you&#8217;re wondering about browser compatibility, it&#8217;s exactly as you&#8217;d expect: everything but IE. It&#8217;s very possible that it&#8217;ll work in IE10, but I haven&#8217;t had the chance to test with a preview release. Since IE8 and IE9 do support<br />
		<code>:before</code><br />
		and<br />
		<code>:after</code><br />
		but not<br />
		<code>border-radius</code><br />
		you&#8217;ll have to create a <a href="http://css-tricks.com/how-to-create-an-ie-only-stylesheet/">separate stylesheet</a> for them if you want to give their users a nice visual experience.
	</p>
<p>
		<a class="button" href="http://css-tricks.com/examples/RoundOutTabs2/">View Demo</a> &nbsp; <a class="button" href="http://css-tricks.com/examples/RoundOutTabs2.zip">Download Files</a>
	</p>
<p>
		<strong>Editor&#8217;s note:</strong> I added anchor links inside the tabs in the demo since I think it&#8217;s the most likely case that tabbed navigation like this have them. Most likely, they would have an<br />
		<code>href</code><br />
		attribute that would link to the content they go with by<br />
		<code>id</code><br />
		, and that behavior would be controlled by JavaScript. The fact that this tutorial doesn&#8217;t need the anchor links for the extra pseudo elements is further testament to it being better than my original.
	</p>
<img src="http://feeds.feedburner.com/~r/goksel/~4/FI_Z8Fjktyc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://geryit.com/blog/better-tabs-with-round-out-borders-by-chris-coyier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<media:content url="http://feedproxy.google.com/~r/goksel/~5/E0fdi56QiRc/RoundOutTabs2.zip" fileSize="1791" type="application/zip" /><itunes:explicit>no</itunes:explicit><itunes:subtitle>The following is a guest post by Menno van Slooten. You might notice we&amp;#8217;ve been down this road before, but I quite like Menno&amp;#8217;s approach here. The end result proves you can get a little fancier with the design than I originally did, with borde</itunes:subtitle><itunes:summary>The following is a guest post by Menno van Slooten. You might notice we&amp;#8217;ve been down this road before, but I quite like Menno&amp;#8217;s approach here. The end result proves you can get a little fancier with the design than I originally did, with borders, gradients, and shadows and while actually using less elements. A [...]</itunes:summary><itunes:keywords>Css3, Design, Out-source, Tutorials</itunes:keywords><feedburner:origLink>http://geryit.com/blog/better-tabs-with-round-out-borders-by-chris-coyier/</feedburner:origLink><enclosure url="http://feedproxy.google.com/~r/goksel/~5/E0fdi56QiRc/RoundOutTabs2.zip" length="1791" type="application/zip" /><feedburner:origEnclosureLink>http://css-tricks.com/examples/RoundOutTabs2.zip</feedburner:origEnclosureLink></item>
		<item>
		<title>Textarea Auto Resize [by ImpressiveWebs]</title>
		<link>http://feedproxy.google.com/~r/goksel/~3/ovNQPbxDvro/</link>
		<comments>http://geryit.com/blog/textarea-auto-resize-by-impressivewebs/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 00:38:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Css3]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Jquery]]></category>
		<category><![CDATA[Out-source]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://geryit.com/blog/?p=1268</guid>
		<description><![CDATA[On a current project, I was trying to find a way to auto-resize a textarea according to some content that would be loaded in dynamically via Ajax. I didn’t know the height of the content and the textarea element doesn’t resize naturally like other HTML elements, so I needed to update the height of the [...]]]></description>
			<content:encoded><![CDATA[<div class="entry-content">
<p><img class="article_image alignleft" title="Textarea Auto Resize" src="http://cdn.impressivewebs.com/2012-01/textarea-auto-resize.jpg" alt="Textarea Auto Resize" width="184" height="184" />On a current project, I was trying to find a way to auto-resize a textarea according to some content that would be loaded in dynamically via Ajax. I didn’t know the height of the content and the textarea element doesn’t resize naturally like other HTML elements, so I needed to update the height of the element with JavaScript each time the content changed.</p>
<p>It seemed like a simple task. After doing a search to see what types of plugins and scripts were floating around to do this, the examples I found seemed a little overly complex. While most solutions seemed to incorporate some complex math calculations, I thought of a better way.</p>
<h2>Using a Hidden Clone Element</h2>
<p>A<br />
<code>&lt;div&gt;</code><br />
element will naturally stretch to fit the height of its content (assuming no floats or absolutely positioned elements are involved). So to get the height of the textarea, I just need to do the following:</p>
<ul class="body_text">
<li>Grab the content loaded into the textarea</li>
<li>Create an invisible clone div</li>
<li>Give the clone the same width and typographical properties as the textarea</li>
<li>Place the content into the clone</li>
<li>Get the height of the clone</li>
<li>Apply the height of the clone to the height of the textarea</li>
</ul>
<h2>The Code</h2>
<p>One of the keys to this solution is the CSS. As mentioned, the invisible clone needs to have the same typographical properties as the textarea. Not only does this include stuff line<br />
<code>font-size</code><br />
and<br />
<code>font-family</code><br />
, but also the<br />
<code>white-space</code><br />
and<br />
<code>word-wrap</code><br />
properties of the clone need to be set to mimic what happens inside the textarea.</p>
<p>First here’s the CSS for the textarea:</p>
<pre class="css">textarea {
    width: 500px;
    min-height: 50px;
    font-family: Arial, sans-serif;
    font-size: 13px;
    color: #444;
    padding: 5px;
}

.noscroll {
    overflow: hidden;
}</pre>
<p>Take note that I’ve added a separate class with<br />
<code>overflow: hidden</code><br />
, to prevent scrollbars from appearing. Normally this would not be a good thing to add to a textarea element, but because I’ll be resizing it with JavaScript, it’s fine. This class will be added to the textarea with JavaScript, to ensure that if JavaScript is turned off, the textarea will scroll normally.</p>
<p>Here is the CSS I’ll be applying to the hidden clone element:</p>
<pre class="php">.hiddendiv {
    display: none;
    white-space: pre-wrap;
    width: 500px;
    min-height: 50px;
    font-family: Arial, sans-serif;
    font-size: 13px;
    padding: 5px;
    word-wrap: break-word;
}</pre>
<p>A quick break-down: First, I set it to<br />
<code>display: none</code><br />
because I don’t want it visible to the user. I believe this should be fine for screen readers, because I don’t want it read out to them either. If anyone has a better solution for hiding it for assistive devices, let me know.</p>
<p>I’ve also set the<br />
<code>white-space</code><br />
property to a value of “pre-wrap”. This ensures that lines will wrap correctly, but everything else gets pre-formatted. I’ve also set the width to be equal to the textarea, and duplicated a few typographical properties. In both examples, I’m giving the clone and the textarea a<br />
<code>min-height</code><br />
so it will always start out at a standard, usable height.</p>
<p>Now for the JavaScript (which is using jQuery, <a href="http://www.impressivewebs.com/why-use-jquery-simple-tutorials/">sorry</a>):</p>
<pre class="js">$(function() {
	var txt = $('#comments'),
	hiddenDiv = $(document.createElement('div')),
	content = null;

	txt.addClass('noscroll');
	hiddenDiv.addClass('hiddendiv');

	$('body').append(hiddenDiv);

	txt.bind('keyup', function() {

	    content = txt.val();
	    content = content.replace(/\n/g, '&lt;br&gt;');
	    hiddenDiv.html(content);

	    txt.css('height', hiddenDiv.height());

	});
});</pre>
<p>This code assumes we’re targeting a single textarea element on the page. If you need this to affect more than one element, then just change the first line inside the function that defines the element we’re working with.</p>
<p>I’m dynamically changing the height based on jQuery’s<br />
<code>keyup</code><br />
event. You could easily change this to respond to an Ajax request instead, if you happen to be loading the content that way.</p>
<p>Using<br />
<code>keyup</code><br />
, however, is a good solution because it’s the most likely reason that you’ll want to auto-resize a textarea — user-entered data.</p>
<h2>What About IE6-8?</h2>
<p>I almost didn’t write this article, because the code wasn’t working at all in IE6-8. The reason for this had to do with the <a href="http://www.quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html">poor way IE handles grabbing content using innerHTML</a>. So after I had written this simple solution that seemed to work in all the newer browsers, I came across <a href="http://javascriptly.com/examples/jquery-grab-bag/autogrow-textarea.html" rel="nofollow">this jQuery plugin</a>. That solution uses the exact same method that I’m using (the cloned element), and it worked (mostly) in IE.</p>
<p>So the line that I borrowed from that example that (mostly) fixed mine in IE was:</p>
<pre class="js">// fixes the IE innerHTML problem
content = content.replace(/\n/g, '&lt;br&gt;');</pre>
<p>But even after adding this line, there was still an issue: Long, unbroken strings of text wouldn’t affect the height of the textarea (which isn’t a big problem, really). A simple fix was adding<br />
<code>word-wrap: break-word</code><br />
to the CSS for the clone element.</p>
<h2>Bugs? Problems?</h2>
<p>Like the other solutions floating around, this could easily be turned into a plugin. In that case, I’d have to add a little more jQuery so that the characteristics of the clone element aren’t dependent on the CSS. Also, if the width of the textarea is fluid, then you’d have to use jQuery to grab that, and then apply it to the clone.</p>
<p>The solution I linked to in the previous section is just about perfect — you just need to add the<br />
<code>word-wrap</code><br />
fix that I mentioned.</p>
<p>For a demo, you can view my JSFiddle using the link below. Just be sure to hit the “run” button before you test it. Let me know if you find any problems with it.</p>
<div class="button_holder">
<ul class="button">
<li><a title="View Demo" href="http://jsfiddle.net/ImpressiveWebs/fGNNT/16/">View Demo</a></li>
</ul>
</div>
</div>
<img src="http://feeds.feedburner.com/~r/goksel/~4/ovNQPbxDvro" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://geryit.com/blog/textarea-auto-resize-by-impressivewebs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://geryit.com/blog/textarea-auto-resize-by-impressivewebs/</feedburner:origLink></item>
		<item>
		<title>Tutorials and snippets to get started with CoffeeScript [by CatsWhoCode]</title>
		<link>http://feedproxy.google.com/~r/goksel/~3/aDPJQni1reg/</link>
		<comments>http://geryit.com/blog/tutorials-and-snippets-to-get-started-with-coffeescript-by-catswhocode/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 20:29:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Out-source]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://geryit.com/blog/?p=1256</guid>
		<description><![CDATA[Tutorials and snippets to get started with CoffeeScript Published on January 9th, 2012 by Jean-Baptiste Jung. 0 Comments - JavaScript is definitely an important part of a website as it allow the developer to interact directly with the web browser. Since 2005, lots of new JavaScript techniques and tools such as Ajax and jQuery became [...]]]></description>
			<content:encoded><![CDATA[<article class="post-4657 post type-post status-publish format-standard hentry category-javascript-2" id="post-4657">
<header>
<h2 class="title">
			<a href="http://www.catswhocode.com/blog/tutorials-and-snippets-to-get-started-with-coffeescript" rel="bookmark" title="Permanent Link to Tutorials and snippets to get started with CoffeeScript">Tutorials and snippets to get started with CoffeeScript</a><br />
		</h2>
<p class="meta">
			<time datetime="2012-01-09">Published on January 9th, 2012</time><br />
			<span class="author">by Jean-Baptiste Jung</span>. <a class="comment" href="http://www.catswhocode.com/blog/tutorials-and-snippets-to-get-started-with-coffeescript#comments">0 Comments</a> -
		</p>
<p><p>JavaScript is definitely an important part of a website as it allow the developer to interact directly with the web browser. Since 2005, lots of new JavaScript techniques and tools such as Ajax and jQuery became extremely popular and made the web a better place. Today, I&#8217;m introducing to you CoffeeScript, a new language that make JavaScript better and simpler.</p>
</p>
</header>
<h2>What is CoffeeScript?</h2>
<p>To keep it simple, CoffeeScript is a little language that compiles into JavaScript. If you ever coded in languages such as Python or Ruby, you&#8217;ll probably love CoffeeScript a lot. Instead of awkward braces and semicolons, JavaScript has always had a gorgeous object model at its heart.</p>
<p>The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. You can use any existing JavaScript library seamlessly from CoffeeScript (and vice-versa). The compiled output is readable and pretty-printed, passes through JavaScript Lint without warnings, will work in every JavaScript implementation, and tends to run as fast or faster than the equivalent handwritten JavaScript.</p>
<h2>Installing CoffeeScript</h2>
<p>
		Installing CoffeeScript is not hard at all. The first thing to do is to make sure that you already installed a working copy of the latest stable version of <a href="http://nodejs.org/">Node.js</a> as well as <a href="http://npmjs.org/">npm</a>, the Node Package Manager.
	</p>
<p>Once done, you can install CoffeeScript by running the following command:</p>
<pre>npm install -g coffee-script</pre>
<p>
		CoffeeScript is now installed. Next step is to compile a<br />
		<code>.coffee</code><br />
		file into a<br />
		<code>.js</code><br />
		file. Use the following syntax to do so:
	</p>
<pre>coffee --compile example.coffee</pre>
<p>
		<a href="http://coffeescript.org/">CoffeeScript.org</a> is the official website of the CoffeeScript language. Don&#8217;t hesitate to visit it, it&#8217;s full of helpful ressources.
	</p>
<h2>Tutorial: Basics of CoffeeScript</h2>
<p>
		<img src="http://www.catswhocode.com/blog/wp-content/uploads/2012/01/coffeescript-tutorial-1.png" alt="" /><br /> A great tutorial that demonstrate all you need to get started with CoffeeScript: installation, configuration and first lines of codes.<br /> <strong>&rarr; <a href="http://sixrevisions.com/javascript/coffeescript-basics/">View tutorial</a></strong>
	</p>
<h2>Tutorial: Rocking out with CoffeeScript</h2>
<p>
		<img src="http://www.catswhocode.com/blog/wp-content/uploads/2012/01/coffeescript-tutorial-2.png" alt="" /><br /> A very complete tutorial that will make you a real CoffeeScript coder: it will show you how to write your code, how to indent, how to use classes, conditionnal statements and more.<br /> <strong>&rarr; <a href="http://net.tutsplus.com/tutorials/javascript-ajax/rocking-out-with-coffeescript/">View tutorial</a></strong>
	</p>
<h2>Tutorial: Creating an iOS-like Home Screen with CoffeeScript</h2>
<p>
		<img src="http://www.catswhocode.com/blog/wp-content/uploads/2012/01/coffeescript-tutorial-3.png" alt="" /><br /> Now, let&#8217;s code something concrete: this tutorial will show you how to create an iOS-like home screen, using CoffeeScript. A great way to learn by the example.<br /> <strong>&rarr; <a href="http://tutorialzine.com/2011/10/ios-homescreen-coffeescript/">View tutorial</a></strong>
	</p>
<h2>CoffeeScript snippet: Shorten url using Google&#8217;s Goo.gl service</h2>
<p>Short urls are very useful, especially on social networking sites like Twitter. Want to be able to create your own short urls using Google goo;gl service? No problem, just use the following code. Please note that you&#8217;ll need your own Google API key for the code to work.</p>
<pre>
apikey = &quot;YOUR GOOGLE API KEY GOES HERE&quot;

shorten_url = (url, success_callback, error_callback) -&gt;

  xhr = Titanium.Network.createHTTPClient()
  xhr.open &quot;POST&quot;, &quot;https://www.googleapis.com/urlshortener/v1/url?key=&quot; + apikey
  xhr.setRequestHeader &quot;Content-type&quot;, &quot;application/json&quot;
  xhr.onload = () -&gt; success_callback xhr.status, xhr.responseText
  xhr.onerror = () -&gt; error_callback xhr.status, xhr.responseText
  content =  &quot;{\&quot;longUrl\&quot;: \&quot;#{url}\&quot;}&quot;
  xhr.send content
</pre>
<p>
		<strong>&rarr; Source: <a href="http://developer.appcelerator.com/question/125880/coffeescript-snippet-for-accessing-googles-url-shortening-service-not-actually-a-question">http://developer.appcelerator.com/question/125880/&#8230;</a></strong>
	</p>
<h2>CoffeScript snippet: Read in a file</h2>
<p>CoffeeScript make reading files very easy, as shown below:</p>
<pre>fs.readFile 'data.txt', (err, data) -> fileText = data</pre>
<p>
		<strong>&rarr; Source: <a href="http://ricardo.cc/2011/06/02/10-CoffeeScript-One-Liners-to-Impress-Your-Friends.html">http://ricardo.cc/2011/06/02/10-CoffeeScript-One-Liners-to-Impress-Your-Friends.html</a></strong>
	</p>
<h2>CoffeScript snippet: Fetch and Parse a XML web service</h2>
<p>Fetching and parsing XML or .json files from web services is quite common when coding modern web applications. Here is how you can do it using CoffeeScript:</p>
<pre>request.get { uri:'path/to/api.json', json: true }, (err, r, body) -> results = body</pre>
<p>
		<strong>&rarr; Source: <a href="http://ricardo.cc/2011/06/02/10-CoffeeScript-One-Liners-to-Impress-Your-Friends.html">http://ricardo.cc/2011/06/02/10-CoffeeScript-One-Liners-to-Impress-Your-Friends.html</a></strong>
	</p>
<h2>CoffeeScript snippet: Finding substrings</h2>
<p>Another very common task, made easier with CoffeeScript:</p>
<pre>
message = "This is a test string. This has a repeat or two. This might even have a third."
message.indexOf "This", 0
</pre>
<p>
		<strong>&rarr; Source: <a href="http://coffeescriptcookbook.com/chapters/strings/finding-substrings">http://coffeescriptcookbook.com/chapters/strings/finding-substrings</a></strong>
	</p>
</article>
<img src="http://feeds.feedburner.com/~r/goksel/~4/aDPJQni1reg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://geryit.com/blog/tutorials-and-snippets-to-get-started-with-coffeescript-by-catswhocode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://geryit.com/blog/tutorials-and-snippets-to-get-started-with-coffeescript-by-catswhocode/</feedburner:origLink></item>
	<media:rating>nonadult</media:rating></channel>
</rss>

