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

<channel>
	<title>Tutorials Archive &#187; Box Shadow</title>
	<atom:link href="http://tutarchive.com/tag/box-shadow/feed/" rel="self" type="application/rss+xml" />
	<link>http://tutarchive.com</link>
	<description>Save and Share your Tutorials</description>
	<lastBuildDate>Thu, 04 Feb 2010 02:51:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>11 Classic CSS Techniques Made Simple with CSS3</title>
		<link>http://tutarchive.com/2009/09/11-classic-css-techniques-made-simple-with-css3/</link>
		<comments>http://tutarchive.com/2009/09/11-classic-css-techniques-made-simple-with-css3/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 16:10:37 +0000</pubDate>
		<dc:creator>TutArchive</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Design & Development]]></category>
		<category><![CDATA[Animations]]></category>
		<category><![CDATA[Background Size]]></category>
		<category><![CDATA[Border Image]]></category>
		<category><![CDATA[Box Shadow]]></category>
		<category><![CDATA[Columns]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Fancy Font]]></category>
		<category><![CDATA[Multiple Backgrounds]]></category>
		<category><![CDATA[Opacity]]></category>
		<category><![CDATA[RGBA]]></category>
		<category><![CDATA[Rounded Corners]]></category>
		<category><![CDATA[Text Shadow]]></category>

		<guid isPermaLink="false">http://tutarchive.com/?p=186</guid>
		<description><![CDATA[CSS3? What's that?!
I'm sure you've heard of CSS in general. CSS3 isn't that much different, in terms of syntax; however, the power of CSS3 is much greater. As you'll see in these eleven techniques, you can have multiple backgrounds, dynamically resize those backgrounds, border radiuses, text shadows, and more!
Here's what the official (or at least, [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<h3>CSS3? What's that?!</h3>
<p>I'm sure you've heard of CSS in general. CSS3 isn't that much different, in terms of syntax; however, the power of CSS3 is much greater. As you'll see in these eleven techniques, you can have multiple backgrounds, dynamically resize those backgrounds, border radiuses, text shadows, and more!</p>
<p>Here's what the official (or at least, what I consider official) website of CSS3, <a href="http://www.css3.info/">css3.info</a>, has to say about CSS3:</p>
<blockquote><p>CSS3 is the new kid in the stylesheet family. It offers exciting new possibilities to create an impact with your designs, allows you to use more diverse style sheets for a variety of occasions and lots more.</p></blockquote>
<p>Here are the 11 techniques that I'll be showing you how to recreate with CSS3. I'll show you how to create them using CSS2 (or JavaScript), and then with CSS3 properties. <em>Remember - these effects will only work in modern browsers that implement these CSS3 features. Your best option is to view these with Safari 4.</em></p>
<ol>
<li><strong>Rounded Corners</strong></li>
<li><strong>Box Shadow</strong></li>
<li><strong>Text Shadow</strong></li>
<li><strong>Fancy Font</strong></li>
<li><strong>Opacity</strong></li>
<li><strong>RGBA</strong></li>
<li><strong>Background Size</strong></li>
<li><strong>Multiple Backgrounds</strong></li>
<li><strong>Columns</strong></li>
<li><strong>Border Image</strong></li>
<li><strong>Animations</strong></li>
</ol>
<p><span id="more-186"></span></p>
<h1>1. Rounded Corners</h1>
<div style="text-align: center;"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/430_cssTips/images/corners.jpg" alt="Rounded Corners" /></div>
<p>Probably my favorite on of this list, rounded corners provide a developer with so many options. You can create a rounded corner button in seconds. My favorite thing to do is set a gradient background to repeat along the x-axis and then apply rounded corners to make a very nice looking Web 2.0 button.</p>
<p>You can simulate rounded corners by using <strong>four extra divs</strong> or by using JavaScript. Though, a user doesn't see these smooth corners if they have JavaScript disabled, I think that's fine as long as the website still functions as it should. You can <a href="http://cssglobe.com/post/3714/css-sprites-rounded-corners/">read up</a> on this method if you would prefer to use pure CSS in making rounded corners.</p>
<p><strong>Classic Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:0--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/jquery.corners.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:1--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:2--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>The classical method uses jQuery along with a JavaScript plugin called <a href="http://plugins.jquery.com/project/corners">Corners</a>.</p>
<p><strong>CSS3 Way</strong></p>
<p>The classical method uses jQuery along with a JavaScript plugin called <a href="http://plugins.jquery.com/project/corners">Corners</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- .box { border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; } --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>As you can see, all that you need to do is specify three CSS3 properties. Eventually, it will only be one; you have to use three now because different browsers use different property names.</p>
<h1>2. Box Shadow</h1>
<div><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/430_cssTips/images/shadow.jpg" alt="Box Shadow" /></div>
<p>Box shadows provide you with a very powerful tool. 99% of the time when I'm desigining, I find myself using drop shadows for something. Once again, I'll be using a jQuery plugin to take care of the classic way because honestly, trying to figure it out with just CSS is confusing. Why should I waste my time fiddling with negative margins when there's already something written that does the job for me? As long as my design looks fine when people have JavaScript disabled, I'm perfectly content using a jQuery plugin.</p>
<p><strong>Classic Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:3--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/jquery.dropShadow.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:4--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:5--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>I'm using the <a href="http://eyebulb.com/dropshadow/">dropShadow</a> plugin. Simple and what I wanted; though I would prefer to use just CSS <img src='http://tutarchive.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p><strong>CSS3 Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- .box { box-shadow: 5px 5px 2px black; -moz-box-shadow: 5px 5px 2px black; -webkit-box-shadow: 5px 5px 2px black; } --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<h1>3. Text Shadow</h1>
<div style="text-align: center;"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/430_cssTips/images/textshadow.jpg" alt="Text Shadow" /></div>
<p>If you've ever read a tutorial about how to make the letterpress effect in Photoshop, you'll know that the drop shadow effect is used. It's really simple to create letterpressed text, just follow <a href="http://line25.com/tutorials/create-a-letterpress-effect-with-css-text-shadow">this tutorial at Line25</a> by Chris Spooner.</p>
<p><strong>Classic Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- .font { font-size: 20px; color: #2178d9; } .fonts { position: relative; } .fonts .font { position: absolute; z-index: 200; } .fonts .second { top: 1px; color: #000; z-index: 100; } --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;fonts&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;font&quot;</span>&gt;</span>The quick brown fox jumps over the lazy dog.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;font second&quot;</span>&gt;</span>The quick brown fox jumps over the lazy dog.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Instead of using a jQuery plugin this time, I just used some simple CSS tricks to absolutely position the text behind the other copy of text. The only bad thing about not using CSS3 for this situation is that you will get two copies of the text if CSS is disabled.</p>
<p><strong>CSS3 Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- .font { font-size: 20px; color: #2178d9; } .font { text-shadow: 0 1px 0 #000; } --&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;font&quot;</span>&gt;</span>The quick brown fox jumps over the lazy dog.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span></pre></div></div>

<h1>4. Fancy Font</h1>
<div style="text-align: center;"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/430_cssTips/images/font.jpg" alt="Fancy Font" /></div>
<p>We've dreamed about it for a long time now, but you can finally display "fancy fonts" on the web <strong>without</strong> relying on JavaScript. Of course this causes some issues with allowing paid fonts to be distributed over the internet. Anyhow, I present you with @font-face.</p>
<p><strong>Classic Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:6--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/cufon.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:7--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/loyal.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:8--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:9--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- .font { font-size: 20px; } --&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;font&quot;</span>&gt;</span>The quick brown fox jumps over the lazy dog.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span></pre></div></div>

<p>I decided to use Cufón to replace the text. I'm not going to explain how to use it because Jeffrey has an awesome screencast already.</p>
<p><strong>CSS3 Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- @font-face { font-family: 'Loyal'; src: url('loyal.ttf'); } .font { font-family: Loyal; font-size: 20px; } --&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;font&quot;</span>&gt;</span>The quick brown fox jumps over the lazy dog.
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span></pre></div></div>

<p>We create a font family with @font-face and then use it as a value for font-family. Michael Owens wrote an article here about a month ago which explains @font-face quite well.</p>
<h1>5. Opacity</h1>
<div style="text-align: center;"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/430_cssTips/images/opacity.jpg" alt="Opacity" /></div>
<p>If you've visited the <a href="http://envato.com/">Envato website</a> redesign lately, you might have noticed that there are a lot of transparent elements. Though this is achieved with transparent PNGs, you can achieve a similar effect by using the opacity property. Now, the opacity property has been around for a while, but our beloved IE has its own properties.</p>
<p><strong>Classic Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- .box { opacity: .6; // all modern browsers (this is CSS3) -ms-filter: &quot;progid:DXImageTransform.Microsoft.Alpha(Opacity=50)&quot;; // IE 8 filter: alpha(opacity=60); // IE 5-7 } --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p><strong>CSS3 Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- .box { opacity: .6; } --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<h1>6. RGBA</h1>
<div><img src="http://nettuts.s3.amazonaws.com/430_cssTips/images/rgba.jpg" alt="RGBA" /></div>
<p>Everyone knows what RGB stands for (red, green, blue), but what does the A stand for? It stands for alpha, which refers to the transparency.</p>
<p>Other than rounded corners, RGBA is my next most used CSS3 property. Sometimes I just want to add a few light white/black background to navigation links when a user hover overs them. It's much easier than creating a new image for each color; however, with a little PHP it makes things a lot easier.</p>
<p><strong>Classic Way</strong></p>
<p>Seeing as how this isn't a PHP article, I won't be going over the PHP. Just save this file as rgba.php and when you need a certain RGBA color, make the background "color" as url(rgba.php?r=R&amp;g=G&amp;b=B&amp;a=A).</p>
<p>Now just apply that to a div...</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- .box { background: url(rgba.php?r=239&amp;#038;g=182&amp;#038;b=29&amp;#038;a=.25); } --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p><strong>CSS3 Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strick" style="font-family:monospace;">&lt;!-- .box { background: rgba(239, 182, 29, .25); } --&gt;
&lt;div class=&quot;box&quot;&gt;
	&lt;!--CONTENT--&gt;&lt;/div&gt;</pre></div></div>

<h1>7. Background Size</h1>
<div style="text-align: center;"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/430_cssTips/images/bgsize.jpg" alt="Background Size" /></div>
<p>The background size property is an amazing thing to have on your tool belt when you're creating a liquid layout. An example of this could be when you have a background image for a container that is for the sidebar. The classic way of doing this would require tweaking to have the image repeat along the y-axis, but with CSS3 it's like adding another background property.</p>
<p><strong>Classic Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- .box { position: relative; overflow: hidden; } 	.box img { 	position: absolute; 	top: 0; 	left: 0; 	width: 50%; 	height: 50%; 	z-index: 100; 	} 	.box .content { 	position: absolute; 	z-index: 200; 	} --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;content&quot;</span>&gt;</span>
		<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://nettuts.s3.amazonaws.com/423_screenr/200x200.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p><strong>CSS3 Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- .box { background: #ccc url(http://nettuts.s3.amazonaws.com/423_screenr/200x200.jpg) no-repeat; -webkit-background-size: 50%; /* Safari */ -o-background-size: 50%; /* Opera */ -khtml-background-size: 50%; /* Konqueror */ } --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<h1>8. Multiple Backgrounds</h1>
<div style="text-align: center;"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/430_cssTips/images/bgs.jpg" alt="Multiple Backgrounds" /></div>
<p>Ah, multiple backgrounds. Now this give developers a very powerful tool. I can think of so many things that require multiple divs just to have more than one background. The most common place I can see this being helpful is in a header section of the website, but that's just the first thing I thought of.<br />
<strong>Classic Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strick" style="font-family:monospace;">&lt;!-- .box { width: 200px; height: 150px; background: url(images/bg.png) repeat-x; } 	.box2 { 	width: 100%; 	height: 100%; 	background: url(images/text.png) center center no-repeat; 	} --&gt;
&lt;div class=&quot;box&quot;&gt;
&lt;div class=&quot;box2&quot;&gt;
		&lt;!--CONTENT--&gt;&lt;/div&gt;
&lt;/div&gt;</pre></div></div>

<p>The classic method is pretty obvious, just wrap the div with another div and so on for each background you need. Produces lovely looking code, doesn't it?</p>
<p><strong>CSS3 Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- .box { width: 200px; height: 150px; background: url(images/text.png) center center no-repeat, url(images/bg.png) repeat-x; } --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>The syntax is really easy to pick up on this one. All you do for the multiple backgrounds is add a comma in between each one! However, once again, this is a limited property and is only in Safari.</p>
<h1>9. Columns</h1>
<div style="text-align: center;"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/430_cssTips/images/columns.jpg" alt="Columns" /></div>
<p>This is the most interesting CSS3 property I've come by. It's not something you see a lot in web design. Myself, I've only seen newspaper-like columns once or twice; however, I love how the effect looks when done correctly. Normally you would separate the content into divs and float those divs, but I found a <a href="http://welcome.totheinter.net/columnizer-jquery-plugin/">jQuery plugin</a> which dynamically renders the columns.</p>
<p><strong>Classic Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:10--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/jquery.columnize.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:11--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:12--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- .column { padding-right: 10px; } .column.last { padding: 0; } --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;columns&quot;</span>&gt;</span>
&nbsp;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla elementum accumsan mi. Maecenas id dui a magna tempor pretium. Quisque id enim. Proin id tortor. Curabitur sit amet enim vitae quam pharetra imperdiet. Nulla diam ante, pellentesque eu, vestibulum non, adipiscing nec, eros. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis a nunc. Donec non dui a velit pulvinar gravida. Nunc rutrum libero vel tortor. Duis sed mi eu metus tincidunt ullamcorper. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In purus lorem, aliquam ac, congue ac, vestibulum quis, felis. Aliquam non sapien.
&nbsp;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla elementum accumsan mi. Maecenas id dui a magna tempor pretium. Quisque id enim. Proin id tortor. Curabitur sit amet enim vitae quam pharetra imperdiet. Nulla diam ante, pellentesque eu, vestibulum non, adipiscing nec, eros. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis a nunc. Donec non dui a velit pulvinar gravida. Nunc rutrum libero vel tortor. Duis sed mi eu metus tincidunt ullamcorper. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In purus lorem, aliquam ac, congue ac, vestibulum quis, felis. Aliquam non sapien.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>I've added a little padding to the columns just so the text isn't smashed up against each other.</p>
<p><strong>CSS3 Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- .columns { -moz-column-count: 2; -webkit-column-count: 2; } --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;columns&quot;</span>&gt;</span>
&nbsp;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla elementum accumsan mi. Maecenas id dui a magna tempor pretium. Quisque id enim. Proin id tortor. Curabitur sit amet enim vitae quam pharetra imperdiet. Nulla diam ante, pellentesque eu, vestibulum non, adipiscing nec, eros. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis a nunc. Donec non dui a velit pulvinar gravida. Nunc rutrum libero vel tortor. Duis sed mi eu metus tincidunt ullamcorper. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In purus lorem, aliquam ac, congue ac, vestibulum quis, felis. Aliquam non sapien.
&nbsp;
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla elementum accumsan mi. Maecenas id dui a magna tempor pretium. Quisque id enim. Proin id tortor. Curabitur sit amet enim vitae quam pharetra imperdiet. Nulla diam ante, pellentesque eu, vestibulum non, adipiscing nec, eros. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Duis a nunc. Donec non dui a velit pulvinar gravida. Nunc rutrum libero vel tortor. Duis sed mi eu metus tincidunt ullamcorper. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In purus lorem, aliquam ac, congue ac, vestibulum quis, felis. Aliquam non sapien.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>There are a handful of other CSS3 column properties that you can apply, but for demonstrative purposes, I only specified the number of columns. If you'd like to learn more about these other properties, check out <a href="http://www.css3.info/preview/multi-column-layout/">the multi-column page at CSS3.info</a>.</p>
<h1>10. Border Image</h1>
<div><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/430_cssTips/images/border.jpg" alt="Border Image" /></div>
<p>I had no clue about the border image property until I upgraded to Firefox 3.5 and went to <a href="http://www.blog.spoongraphics.co.uk/">Chris Spooner's website</a> and saw that his post images had image borders. I personally don't have any interest in this property, but that's not going to stop me from explaining how to achieve it.</p>
<p><strong>Classic Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:13--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;js/jquery.borderImage.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:14--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:15--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!-- .box { border-width: 20px; } --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Instead of spending the time creating multiple divs and repeating the background image around the div, I found a jQuery plugin that does the work for me. It's called <a href="http://plugins.jquery.com/project/jbi">borderImage</a> and works just like it should.</p>
<p><strong>CSS3 Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- .box { border-width: 20px; -webkit-border-image: url(images/border.png) 27 round; -moz-border-image: url(images/border.png) 27 round; border-image: url(images/border.png) 27 round; } --&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>As you can see, the border image property is a bit odd. <a href="http://www.w3.org/TR/css3-background/#the-border-image">W3</a> explains how it gets calculated <strong>MUCH</strong> better.</p>
<h1>11. Animations</h1>
<div style="text-align: center;"><img style="display: inline;" src="http://nettuts.s3.amazonaws.com/430_cssTips/images/animation.jpg" alt="Animations" /></div>
<p>Alright, who doesn't love to see some element gently slide to the left or fade in when you hover over something? Animations are great to increase user interface, but make sure that you don't go over board! The only browsers that support CSS3 animations are Webkit based browsers. The only other way to display animations is to use JavaScript. I'll be using jQuery because it's my favorite JavaScript library (if you haven't guessed by now).</p>
<p><strong>Classic Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:16--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!--mce:17--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #808080; font-style: italic;">&lt;!--</span>
&nbsp;
<span style="color: #808080; font-style: italic;">.box {</span>
&nbsp;
<span style="color: #808080; font-style: italic;">position: relative;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">}</span>
&nbsp;
<span style="color: #808080; font-style: italic;">--&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p><strong>CSS3 Way</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--</span>
&nbsp;
<span style="color: #808080; font-style: italic;">.box {</span>
&nbsp;
<span style="color: #808080; font-style: italic;">position: relative;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">-webkit-transition: top 300ms linear;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">}</span>
&nbsp;
<span style="color: #808080; font-style: italic;">.box:hover {</span>
&nbsp;
<span style="color: #808080; font-style: italic;">top: 20px;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">}</span>
&nbsp;
<span style="color: #808080; font-style: italic;">--&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;box&quot;</span>&gt;</span>
	<span style="color: #808080; font-style: italic;">&lt;!--CONTENT--&gt;</span><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

<p>Both of these code snippets do the same thing: slide the div 20 pixels down over the course of 300 ms. Remember, the CSS3 code only works in Webkit browsers!</p>
<h1>Conclusion</h1>
<p>There you have it: 11 CSS techniques that will become much easier with CSS3 in the (hopefully near) future. Obviously, it'll be a while before we can 100% depend on these properties across all browsers.</p>
<p>Don't forget to review these other Nettuts+ tutorials that discuss CSS3:</p>
<p style="text-align: right;">From <strong>TutPlus</strong></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://tutarchive.com/2009/09/11-classic-css-techniques-made-simple-with-css3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
