<?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>jc-designs.net &#187; CSS</title>
	<atom:link href="http://jc-designs.net/blog/category/web-development/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://jc-designs.net/blog</link>
	<description>jc-designs blog</description>
	<lastBuildDate>Mon, 21 May 2012 19:32:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Little jQuery Slider Navigation</title>
		<link>http://jc-designs.net/blog/2011/02/little-jquery-slider-navigation/</link>
		<comments>http://jc-designs.net/blog/2011/02/little-jquery-slider-navigation/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 21:36:24 +0000</pubDate>
		<dc:creator>jcDesigns</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://jc-designs.net/blog/?p=719</guid>
		<description><![CDATA[I love the little stuff jQuery can do I was noodling around the other day with jQuery, and decided to share another simple little navigation script. It is only 8 lines of code, which includes the ready function, and closing brackets, so if you actually take into account just the stuff that matters, only 5 [...]]]></description>
			<content:encoded><![CDATA[</h3>
<p>I love the little stuff jQuery can do</h3>
<p>I was noodling around the other day with jQuery, and decided to share another simple little navigation script. It is only 8 lines of code, which includes the ready function, and closing brackets, so if you actually take into account just the stuff that matters, only 5 lines. You can check out the demo below.</p>
<p><a href="http://jc-designs.net/demo/newMenu.html" class="viewDemo">View Demo</a></p>
<p>Yes, all it does is move the arrow around on rollover, but it is a simple effect and you might be able to come up with something better knowing how to do this.</p>
<p><span id="more-719"></span><br />
Here is the HTML you will need:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;color: #439AD0; font-weight: bold;">&lt;div id=&quot;container&quot;&gt;
	&lt;ul&gt;
    	&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#&quot;&gt;About Us&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Services&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Contact Us&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Blog&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div id=&quot;arrow&quot;&gt;&lt;/div&gt;
&lt;/div&gt;</pre></div></div>

<p>Here is the CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">font</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">bold</span> <span style="color: #933;">14px</span> Arial<span style="color: #00AA00;color: #439AD0;">,</span> Helvetica<span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #993333;color: #439AD0;">sans-serif</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">1000px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">margin</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">50px</span> <span style="color: #993333;color: #439AD0;">auto</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">position</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">relative</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">border-bottom</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#99CC99</span> <span style="color: #993333;color: #439AD0;">solid</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">padding</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #933;">2px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
ul <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">margin</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">0</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">padding</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">0</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background-color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#778377</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">overflow</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">hidden</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
li <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">list-style</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">none</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
a <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">display</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">block</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">float</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">left</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">padding</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">5px</span> <span style="color: #933;">10px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">border-right</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#000000</span> <span style="color: #993333;color: #439AD0;">solid</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">text-decoration</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">none</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">text-align</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">center</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">outline</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">none</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background-color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#778377</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-moz-transition-property<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">background-color</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-webkit-transition-property<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">background-color</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-moz-transition-duration<span style="color: #00AA00;color: #439AD0;">:</span> 0.8s<span style="color: #00AA00;color: #439AD0;">;</span>
	-webkit-transition-duration<span style="color: #00AA00;color: #439AD0;">:</span> 0.8s<span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#99CC99</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background-color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#525f52</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#arrow</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">height</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">url</span><span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/newMenuArrow.png</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> <span style="color: #993333;color: #439AD0;">no-repeat</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">left</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">position</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">absolute</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">left</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">0</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">margin</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #933;">55px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>If you look at this nav in a webkit browser you will see the background color transitions that are defined in the CSS. In every other browser, you just won&#8217;t see the color fade in.</p>
<p>Here is the jQuery:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;color: #439AD0; font-weight: bold;">$<span style="color: #009900;color: #439AD0;">&#40;</span>document<span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #003366; font-weight: bold;color: #439AD0;">function</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#41;</span> <span style="color: #009900;color: #439AD0;">&#123;</span>
	<span style="color: #003366; font-weight: bold;color: #439AD0;">var</span> currentPosition <span style="color: #339933;color: #439AD0;">=</span> <span style="color: #CC0000;color: #439AD0;">0</span><span style="color: #339933;color: #439AD0;">;</span>
	<span style="color: #003366; font-weight: bold;color: #439AD0;">var</span> moveWidth <span style="color: #339933;color: #439AD0;">=</span> <span style="color: #CC0000;color: #439AD0;">120</span><span style="color: #339933;color: #439AD0;">;</span>
&nbsp;
	$<span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'ul'</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">delegate</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">&quot;li&quot;</span><span style="color: #339933;color: #439AD0;">,</span> <span style="color: #3366CC;color: #439AD0;">&quot;mouseover&quot;</span><span style="color: #339933;color: #439AD0;">,</span> <span style="color: #003366; font-weight: bold;color: #439AD0;">function</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#41;</span> <span style="color: #009900;color: #439AD0;">&#123;</span>
		currentPosition <span style="color: #339933;color: #439AD0;">=</span> <span style="color: #009900;color: #439AD0;">&#40;</span>$<span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #000066; font-weight: bold;color: #439AD0;">this</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">index</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span>
		$<span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'#arrow'</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#123;</span><span style="color: #3366CC;color: #439AD0;">'left'</span> <span style="color: #339933;color: #439AD0;">:</span> moveWidth<span style="color: #339933;color: #439AD0;">*</span><span style="color: #009900;color: #439AD0;">&#40;</span>currentPosition<span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #009900;color: #439AD0;">&#125;</span><span style="color: #339933;color: #439AD0;">,</span> <span style="color: #CC0000;color: #439AD0;">200</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span>	
	<span style="color: #009900;color: #439AD0;">&#125;</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span>
<span style="color: #009900;color: #439AD0;">&#125;</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span></pre></div></div>

<h3>What is going on there?</h3>
<p>Glad you asked or there wouldn&#8217;t be a point to this, would there? First are a couple of variables which you will need to make all this work. The currentPosition variable is the index value of the &#8216;li&#8217; you rollover. At the start, it is set to 0. The moveWidth is set to 120 because I made this navigation to be a fixed width nav. Now we get into the actual move stuff code.</p>
<p>The delegate is actually cool in that it sets the mouseover handler on the &#8216;ul&#8217;. It checks to see if an &#8216;li&#8217; was moused over, and if so, run the function. If you didn&#8217;t use delegate, you would then have a handler on each &#8216;li&#8217;. This means better efficiency with jQuery. So you mouseover an &#8216;li&#8217;, and the function is called, which sets the current position to the index value of &#8216;this&#8217;, which is the &#8216;li&#8217; your mouse is on. Then the animation on the div with an id of &#8216;arrow&#8217; happens. That div moves &#8216;left&#8217; equal to the amount of the variable &#8216;moveWidth&#8217; (which is 120) times the currentPosition variable. So if you rollover the second &#8216;li&#8217;, its index value is 1, then times that by 120. In that case, &#8216;left&#8217; would be 120. Those numbers are recalculated every time you rollover an &#8216;li&#8217; and the &#8216;arrow&#8217; div then moves the correct amount. The &#8217;200&#8242; at the end is just the speed I want the animation to move. You can change that to whatever you want.</p>
<h3>Further reading</h3>
<p>Like I stated at the beginning, this is a simple script, doing a simple animation. If you look at it in a webkit browser, you will see the color changes from the CSS transition. If you are really new to jQuery, looking at little bits of code like this helps you figure out a lot. I also wrote an article a while back on jQuery&#8217;s delegate method, which you can <a href="http://jc-designs.net/blog/2010/04/jquery-delegate-and-what-it-does/" target="_blank">read here</a>.</p>
<p>Any questions, let me know! And I hope you guys new at jQuery learned a little!</p>
<div class="gator">
<a  href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=jcDesigns-" rel="nofollow"><img src="http://tracking.hostgator.com/img/Shared/468x60.gif" border=0></a></p>
<p>Coupon Code: webmachine</p>
</div>
 <img src="http://jc-designs.net/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=719" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://jc-designs.net/blog/2011/02/little-jquery-slider-navigation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial &#8211; CSS And jQuery/Ext Trap Door Navigation</title>
		<link>http://jc-designs.net/blog/2011/01/tutorial-css-and-jqueryext-trap-door-navigation/</link>
		<comments>http://jc-designs.net/blog/2011/01/tutorial-css-and-jqueryext-trap-door-navigation/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 23:13:22 +0000</pubDate>
		<dc:creator>jcDesigns</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jc-designs.net/blog/?p=727</guid>
		<description><![CDATA[Dual library action I&#8217;ll be showing you how to do a trap door navigation, which I&#8217;m sure has been done before. But I&#8217;ll be showing you how to do it in jQuery AND Ext. Why? Because I had to do it in both at work. A trap door navigation is basically a two image system [...]]]></description>
			<content:encoded><![CDATA[<h3>Dual library action</h3>
<p>I&#8217;ll be showing you how to do a trap door navigation, which I&#8217;m sure has been done before. But I&#8217;ll be showing you how to do it in jQuery AND Ext. Why? Because I had to do it in both at work. A trap door navigation is basically a two image system where the &#8216;li&#8217; gets one image, and the &#8216;a&#8217; tag gets another so that as the link expands, the image grows with it. When you rollover each navigation item, the images then change.</p>
<p>Why thought can&#8217;t you do this with just CSS? You could try like I did using something like &#8216;li:hover&#8217;, but the problem occurs on when the images actually change on rollover. There are issues with the &#8216;li&#8217; image changing because the &#8216;a&#8217; tag is on top and that is what you are rolling over. Javascript is used then to correct the issue. Check out the result:</p>
<p><a target="_blank" class="viewDemo" href="http://www.jc-designs.net/demo/trapDoor.html">View Demo</a></p>
<p><span id="more-727"></span><br />
What you need to start with, is a cut up image (I prefer slicing, but you do it however you want). You need to versions: what the buttons will look like normally, and what they look like on hover. You end up with 4 images &#8211; 2 for the normal, 2 for hover. Below is what I did for the rollover image:</p>
<div class="center">
<div id="attachment_796" class="wp-caption alignnone" style="width: 577px"><img src="http://jc-designs.net/blog/wp-content/uploads/2011/01/trapSliced.jpg" alt="Sliced nav image" title="trapSliced" width="567" height="78" class="size-full wp-image-796" /><p class="wp-caption-text">Sliced nav image</p></div>
</div>
<p>The slice with the number 2 is what goes on the &#8216;li&#8217;, while the &#8217;1&#8242; goes on the &#8216;a&#8217; tag.</p>
<p>Here is the basic HTML you need:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;color: #439AD0; font-weight: bold;">&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#&quot;&gt;About Us&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Services&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Our Really Kick Ass Blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Contact us&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre></div></div>

<p>Below is the CSS you need (any other tags don&#8217;t matter for the tutorial). As you can see, the &#8216;li&#8217; has a background call for the image that is seen normally, and it is the longer image of the two. The &#8216;a&#8217; tag has a background call of the shorter image.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;">li <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">list-style</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">none</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">url</span><span style="color: #00AA00;color: #439AD0;">&#40;</span>images/trapOff_02.jpg<span style="color: #00AA00;color: #439AD0;">&#41;</span> <span style="color: #993333;color: #439AD0;">no-repeat</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">right</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">float</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">left</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
a <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">text-decoration</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">none</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#000000</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">display</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">block</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">float</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">left</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">text-transform</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">uppercase</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">url</span><span style="color: #00AA00;color: #439AD0;">&#40;</span>images/trapOff_01.jpg<span style="color: #00AA00;color: #439AD0;">&#41;</span> <span style="color: #993333;color: #439AD0;">no-repeat</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">left</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">padding</span><span style="color: #00AA00;color: #439AD0;">:</span><span style="color: #933;">11px</span> <span style="color: #933;">16px</span> <span style="color: #933;">3px</span> <span style="color: #933;">13px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>Now onto the jQuery, which I&#8217;ll explain after you look over it:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;color: #439AD0; font-weight: bold;">$<span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'ul&gt;li&gt;a'</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">hover</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #003366; font-weight: bold;color: #439AD0;">function</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#41;</span> <span style="color: #009900;color: #439AD0;">&#123;</span>
        $<span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #000066; font-weight: bold;color: #439AD0;">this</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'background-image'</span><span style="color: #339933;color: #439AD0;">,</span> <span style="color: #3366CC;color: #439AD0;">'url(&quot;images/trapOn_02.jpg&quot;)'</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span>               
        $<span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #000066; font-weight: bold;color: #439AD0;">this</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">&quot;background-image&quot;</span><span style="color: #339933;color: #439AD0;">,</span> <span style="color: #3366CC;color: #439AD0;">'url(&quot;images/trapOn_01.jpg&quot;)'</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span>  
  <span style="color: #009900;color: #439AD0;">&#125;</span><span style="color: #339933;color: #439AD0;">,</span> <span style="color: #003366; font-weight: bold;color: #439AD0;">function</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#41;</span> <span style="color: #009900;color: #439AD0;">&#123;</span>               
       $<span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #000066; font-weight: bold;color: #439AD0;">this</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'background-image'</span><span style="color: #339933;color: #439AD0;">,</span> <span style="color: #3366CC;color: #439AD0;">'url(&quot;images/trapOff_02.jpg&quot;)'</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span>               
        $<span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #000066; font-weight: bold;color: #439AD0;">this</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'background-image'</span><span style="color: #339933;color: #439AD0;">,</span> <span style="color: #3366CC;color: #439AD0;">'url(&quot;images/trapOff_01.jpg&quot;)'</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span>                  
  <span style="color: #009900;color: #439AD0;">&#125;</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span></pre></div></div>

<h3>The break down</h3>
<p>All it is, is a basic hover() method. The first line above, searches for the &#8216;a&#8217; tag in a list item within a ul (ul>li>a), and puts the hover() method on it. The second line finds the &#8216;a&#8217; tag, but get&#8217;s its parent, which would be its it containing &#8216;li&#8217;. It then uses the css() method to change the background-image to the rollover state image. The third line does the same for the actual &#8216;a&#8217; tag.</p>
<p>The callback function, then reverses the images so that when you are not hovering over the navigation item, it goes back to normal. That is all there is to it.</p>
<h3>Ext &#8211; The Extra Terrestrial</h3>
<p>To do the same exact thing in Ext JS, some of the stuff changes. I won&#8217;t go over it, because most of you probably don&#8217;t even know the library exists, but you can see the differences.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;color: #439AD0; font-weight: bold;">Ext.<span style="color: #660066;">select</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'div#slot-navigation&gt;ul&gt;li&gt;a'</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">on</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'mouseover'</span><span style="color: #339933;color: #439AD0;">,</span> <span style="color: #003366; font-weight: bold;color: #439AD0;">function</span><span style="color: #009900;color: #439AD0;">&#40;</span>e<span style="color: #339933;color: #439AD0;">,</span>t<span style="color: #339933;color: #439AD0;">,</span>o<span style="color: #009900;color: #439AD0;">&#41;</span> <span style="color: #009900;color: #439AD0;">&#123;</span>
        Ext.<span style="color: #660066;">fly</span><span style="color: #009900;color: #439AD0;">&#40;</span>t<span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">setStyle</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#123;</span>
          <span style="color: #3366CC;color: #439AD0;">'background-image'</span><span style="color: #339933;color: #439AD0;">:</span> <span style="color: #3366CC;color: #439AD0;">'url(&quot;/images/trapOn_02.jpg&quot;)'</span>       
        <span style="color: #009900;color: #439AD0;">&#125;</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span>               
        Ext.<span style="color: #660066;">fly</span><span style="color: #009900;color: #439AD0;">&#40;</span>t<span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">setStyle</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#123;</span>
          <span style="color: #3366CC;color: #439AD0;">'background-image'</span><span style="color: #339933;color: #439AD0;">:</span> <span style="color: #3366CC;color: #439AD0;">'url(&quot;/images/trapOn_01.jpg&quot;)'</span>       
        <span style="color: #009900;color: #439AD0;">&#125;</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span>    
  <span style="color: #009900;color: #439AD0;">&#125;</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span> 
&nbsp;
  Ext.<span style="color: #660066;">select</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'div#slot-navigation&gt;ul&gt;li&gt;a'</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">on</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'mouseout'</span><span style="color: #339933;color: #439AD0;">,</span> <span style="color: #003366; font-weight: bold;color: #439AD0;">function</span><span style="color: #009900;color: #439AD0;">&#40;</span>e<span style="color: #339933;color: #439AD0;">,</span>t<span style="color: #339933;color: #439AD0;">,</span>o<span style="color: #009900;color: #439AD0;">&#41;</span> <span style="color: #009900;color: #439AD0;">&#123;</span>               
        Ext.<span style="color: #660066;">fly</span><span style="color: #009900;color: #439AD0;">&#40;</span>t<span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">parent</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">setStyle</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#123;</span>
          <span style="color: #3366CC;color: #439AD0;">'background-image'</span><span style="color: #339933;color: #439AD0;">:</span> <span style="color: #3366CC;color: #439AD0;">'url(&quot;/images/trapOff_02.jpg&quot;)'</span>       
        <span style="color: #009900;color: #439AD0;">&#125;</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span>               
        Ext.<span style="color: #660066;">fly</span><span style="color: #009900;color: #439AD0;">&#40;</span>t<span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">setStyle</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#123;</span>
          <span style="color: #3366CC;color: #439AD0;">'background-image'</span><span style="color: #339933;color: #439AD0;">:</span> <span style="color: #3366CC;color: #439AD0;">'url(&quot;/images/trapOff_01.jpg&quot;)'</span>       
        <span style="color: #009900;color: #439AD0;">&#125;</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span>                  
  <span style="color: #009900;color: #439AD0;">&#125;</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span></pre></div></div>

<h3>Final thoughts</h3>
<p>Sometimes CSS isn&#8217;t enough to accomplish a certain effect. In this case, I wish it was because it seems like such a simple thing. But, it doesn&#8217;t take much javascript to make this work. Hope you learned something!</p>
<div class="gator">
<a  href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=jcDesigns-" rel="nofollow"><img src="http://tracking.hostgator.com/img/Shared/468x60.gif" border=0></a></p>
<p>Coupon Code: webmachine</p>
</div>
 <img src="http://jc-designs.net/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=727" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://jc-designs.net/blog/2011/01/tutorial-css-and-jqueryext-trap-door-navigation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Variables, Mixins and Nesting Might Be Coming</title>
		<link>http://jc-designs.net/blog/2011/01/css-variables-mixins-and-nesting-might-be-coming/</link>
		<comments>http://jc-designs.net/blog/2011/01/css-variables-mixins-and-nesting-might-be-coming/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 20:08:12 +0000</pubDate>
		<dc:creator>jcDesigns</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Sass/Less/Compass]]></category>
		<category><![CDATA[LESS]]></category>
		<category><![CDATA[sass]]></category>

		<guid isPermaLink="false">http://jc-designs.net/blog/?p=786</guid>
		<description><![CDATA[If you don&#8217;t know Sass&#8230;you might want to now I&#8217;ve read a couple of posts/articles in the past week that REALLY got me excited again about CSS. A guy over at Google, Tab Atkins, has hinted at it, and then this article by Johan Brook talks about it as well. What the hell am I [...]]]></description>
			<content:encoded><![CDATA[<h3>If you don&#8217;t know Sass&#8230;you might want to now</h3>
<p>I&#8217;ve read a couple of posts/articles in the past week that REALLY got me excited again about CSS. A guy over at Google, <a href="http://twitter.com/tabatkins">Tab Atkins</a>, has hinted at it, and then <a href="http://johanbrook.com/quickies/webkit-css-variables-mixins-nesting/">this articl</a>e by Johan Brook talks about it as well.</p>
<p>What the hell am I talking about you ask? Well by the title of this post you should have figured it out.You know all those articles I&#8217;ve posted about my experience with Sass and how much I love it? Or maybe my artilce on LESS.js? There are other articles around the net where people commented their worries and complaints on why they didn&#8217;t need or use it. Well guess what&#8230;you might want to rethink that and start learning. Variables, mixins and nesting might be coming to CSS itself. If you didn&#8217;t read the article I linked to above, Webkit is thinking about it, and it may be here as soon as the end of this year.</p>
<p><span id="more-786"></span></p>
<h3>What does this mean for web developers?</h3>
<p>Adding these things into CSS would be a dream come true, and now that there is some actual discussion going on to make this happen (and from people at Google!), that dream is closer to reality. If Chrome (I assume Safari is included in that) adds this functionality in, I think Firefox will be close behind. That&#8217;s cool and all, I know, but what does that mean for us?</p>
<p>Simple answer: A whole lot of awesome! Smaller and tight stylesheets! Possibly quicker development time. Might as well start learning it now, cause its not hard, but you do have to put some effort into it to get it down.</p>
<p>CSS seems to be growing in what it handles and does, and faster than people are learning it. Trust me, I work with people who don&#8217;t even have CSS2 down and they&#8217;ve been working with it for two years. If adding things like this culls the heard a little, I for one am all for it.</p>
<h3>What are these new features anyway?</h3>
<p>Here is a real quick example of what I have used so far in my redesign of my website, so you can see what we have to look forward to. This is from my Sass file, and is for the right sidebar of my <a href="http://jc-designs.net" target="_blank">home page</a>.</p>
<p>Below includes some variables, a couple of mixins, and some nested stuff:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;">/Variables
$dkgray<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#2d2d2d</span><span style="color: #00AA00;color: #439AD0;">;</span>
$orange<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#f15c22</span><span style="color: #00AA00;color: #439AD0;">;</span>
$wht<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;color: #439AD0;">;</span>
$w<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">1020px</span><span style="color: #00AA00;color: #439AD0;">;</span>
$r<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">right</span><span style="color: #00AA00;color: #439AD0;">;</span>
$l<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">left</span><span style="color: #00AA00;color: #439AD0;">;</span>
&nbsp;
<span style="color: #a1a100;color: #439AD0;">@mixin font ($size, $weight, $family: &quot;Arial,Helvetica,sans-serif&quot;){</span>
  <span style="color: #000000; font-weight: bold;color: #439AD0;">font</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
    family<span style="color: #00AA00;color: #439AD0;">:</span> #<span style="color: #00AA00;color: #439AD0;">&#123;</span>$family<span style="color: #00AA00;color: #439AD0;">&#125;</span><span style="color: #00AA00;color: #439AD0;">;</span>
    <span style="color: #000000; font-weight: bold;color: #439AD0;">size</span><span style="color: #00AA00;color: #439AD0;">:</span> $size<span style="color: #00AA00;color: #439AD0;">;</span>
    weight<span style="color: #00AA00;color: #439AD0;">:</span> #<span style="color: #00AA00;color: #439AD0;">&#123;</span>$weight<span style="color: #00AA00;color: #439AD0;">&#125;</span><span style="color: #00AA00;color: #439AD0;">;</span>
  <span style="color: #00AA00;color: #439AD0;">&#125;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
<span style="color: #a1a100;color: #439AD0;">@mixin sprite($left, $top) {</span>
    <span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span>  <span style="color: #993333;color: #439AD0;">url</span><span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #ff0000; font-style: italic;">../images/iconSprite.png</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> <span style="color: #993333;color: #439AD0;">no-repeat</span> $left $top<span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#calltoAction</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">260px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">height</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">181px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">url</span><span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #ff0000; font-style: italic;">../images/calltoAction.png</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> <span style="color: #993333;color: #439AD0;">no-repeat</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">left</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> $dkgray<span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">padding</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">25px</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #cc66cc;color: #439AD0;">0</span><span style="color: #00AA00;color: #439AD0;">;</span>
	h1 <span style="color: #00AA00;color: #439AD0;">&#123;</span>
		<span style="color: #a1a100;color: #439AD0;">@include font(16px, &quot;bold&quot;);</span>
		<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> $dkgray<span style="color: #00AA00;color: #439AD0;">;</span>
		<span style="color: #000000; font-weight: bold;color: #439AD0;">text-align</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">center</span><span style="color: #00AA00;color: #439AD0;">;</span>
		<span style="color: #000000; font-weight: bold;color: #439AD0;">text-shadow</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">none</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #00AA00;color: #439AD0;">&#125;</span>
	h2 <span style="color: #00AA00;color: #439AD0;">&#123;</span>
		<span style="color: #a1a100;color: #439AD0;">@include font(42px, &quot;bold&quot;, &quot;Bebas, Arial,Helvetica,sans-serif&quot;);</span>
		<span style="color: #a1a100;color: #439AD0;">@include sprite(210px, 13px);</span>
		<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> $dkgray<span style="color: #00AA00;color: #439AD0;">;</span>
		<span style="color: #000000; font-weight: bold;color: #439AD0;">text-align</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">center</span><span style="color: #00AA00;color: #439AD0;">;</span>
		<span style="color: #000000; font-weight: bold;color: #439AD0;">padding</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #933;">18px</span> <span style="color: #933;">4px</span> <span style="color: #cc66cc;color: #439AD0;">0</span><span style="color: #00AA00;color: #439AD0;">;</span>
		<span style="color: #000000; font-weight: bold;color: #439AD0;">text-shadow</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">3px</span> <span style="color: #cc00cc;">#999</span><span style="color: #00AA00;color: #439AD0;">;</span>
		<span style="color: #000000; font-weight: bold;color: #439AD0;">border</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">none</span><span style="color: #00AA00;color: #439AD0;">;</span>
		a <span style="color: #00AA00;color: #439AD0;">&#123;</span>
			<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> $dkgray<span style="color: #00AA00;color: #439AD0;">;</span>
			&amp;<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;color: #439AD0;">&#123;</span>
			<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> $orange<span style="color: #00AA00;color: #439AD0;">;</span>
			<span style="color: #00AA00;color: #439AD0;">&#125;</span>
		<span style="color: #00AA00;color: #439AD0;">&#125;</span>
	<span style="color: #00AA00;color: #439AD0;">&#125;</span>
	h3 <span style="color: #00AA00;color: #439AD0;">&#123;</span>
		<span style="color: #a1a100;color: #439AD0;">@include font(16px, &quot;bold&quot;);</span>
		<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> $dkgray<span style="color: #00AA00;color: #439AD0;">;</span>
		<span style="color: #000000; font-weight: bold;color: #439AD0;">text-align</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">right</span><span style="color: #00AA00;color: #439AD0;">;</span>
		<span style="color: #000000; font-weight: bold;color: #439AD0;">margin</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #933;">20px</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #cc66cc;color: #439AD0;">0</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #00AA00;color: #439AD0;">&#125;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>The tag with an id of #calltoAction has a variable call:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> $dkgray</pre></div></div>

<p>Now, $dkgray is set to #2d2d2d, but the best part is, I don&#8217;t have to remember the damn hex code for that color. Seems silly at first, but takes less thinking on my part, and really easy to change that color across the board if I have to. No find and replace needed.</p>
<p>You will also see that there is an h1 nested with in that #calltoAction, which only styles the h1 tags within it. This avoids repetition by nesting selectors within one another. Awesome. If you look at the above code you can see I&#8217;ve nested some things even deeper, to style the &#8216;h2 a&#8217; styles.</p>
<p>There is also the mixin calls. If you look at the top of the code above, you see a mixin for the sprite. Anytime I want to use that same sprite (and I do quite often), I type something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #a1a100;color: #439AD0;">@include sprite(210px, 13px);</span></pre></div></div>

<p>All that I have to change each time are the pixel numbers for the position. This means less typing and smaller file sizes when all of these things are used. A LOT less repetition goes on throughout as well.</p>
<h3>What do you think about this?</h3>
<p>Sass and Compass let me do this cool crap now, but if CSS gets this functionality, and compiling happens in browser, there is going to be a lot of happiness. Probably a lot of grumbling and haters as well, but who cares about them? CSS was becoming tedious to write for me without Sass. This will make it fun again for me, and a lot faster to write. I think it needed it, and this is long over due. What do you guys think?</p>
<div class="gator">
<a  href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=jcDesigns-" rel="nofollow"><img src="http://tracking.hostgator.com/img/Shared/468x60.gif" border=0></a></p>
<p>Coupon Code: webmachine</p>
</div>
 <img src="http://jc-designs.net/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=786" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://jc-designs.net/blog/2011/01/css-variables-mixins-and-nesting-might-be-coming/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Trying Out A Simple CSS3 Animation</title>
		<link>http://jc-designs.net/blog/2010/11/trying-out-a-simple-css3-animation/</link>
		<comments>http://jc-designs.net/blog/2010/11/trying-out-a-simple-css3-animation/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 04:24:14 +0000</pubDate>
		<dc:creator>jcDesigns</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://jc-designs.net/blog/?p=642</guid>
		<description><![CDATA[Simple animation, harder to implement That sums it up quite nicely I think. If you click on the demo below (my actual redesign) and look at it in Chrome (or Safari, though I didn&#8217;t look I&#8217;ll assume it works there), you will notice that when you roll over the social media icons in the right [...]]]></description>
			<content:encoded><![CDATA[<h3>Simple animation, harder to implement</h3>
<p>That sums it up quite nicely I think. If you click on the demo below (my actual redesign) and look at it in Chrome (or Safari, though I didn&#8217;t look I&#8217;ll assume it works there), you will notice that when you roll over the social media icons in the right sidebar, they will change size. I was very proud of myself for accomplishing what I think very few web developers actually use. I&#8217;ll go over what I think about CSS3 Animations at the end of the article, but for now, let&#8217;s go over how I accomplished this.</p>
<p><a href="http://jc-designs.net/index2010.php" target="_blank" class="viewDemo">View Demo</a></p>
<p><span id="more-642"></span><br />
Cool eh? Until you actually see how much CSS is needed to accomplish this. Keep in mind that I wrote this in Sass (and using Compass&#8217; built in CSS3 mixins), so it actually took waaaaay less lines to do. What I&#8217;ll show you though is the actual CSS output that you would have to write if you are NOT writing Sass&#8230;which is most of you. The icons are in an unordered list, just so you are informed</p>
<p>The first part are the styles for the li&#8217;s:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #cc00cc;">#social</span> ul li <span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">list-style</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">none</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">float</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">left</span><span style="color: #00AA00;color: #439AD0;">;</span>
-moz-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-o-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-animation-name<span style="color: #00AA00;color: #439AD0;">:</span> resize2<span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-animation-duration<span style="color: #00AA00;color: #439AD0;">:</span> .5s<span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-animation-iteration-count<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-animation-timing-function<span style="color: #00AA00;color: #439AD0;">:</span> ease-in-out<span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>As you can see I have a transform: scale on there that is actually keeping it the actual size it should be. That is because there is a hover on the li that will increase its size, so I need the un-hovered li to be at the default. After that you have a call to an animation called &#8216;resize2&#8242;. Remember that, because you&#8217;ll see what is going on with that in a bit. I want the animation to last a half second, iteration-count means how many times and I only want it to run once, and then I want it to ease in and out smoothly. So far so good?</p>
<p>Now for the li:hover styles:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #cc00cc;">#social</span> ul li<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;color: #439AD0;">&#123;</span>
-moz-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-o-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-animation-name<span style="color: #00AA00;color: #439AD0;">:</span> resize<span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-animation-duration<span style="color: #00AA00;color: #439AD0;">:</span> .5s<span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-animation-iteration-count<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-animation-timing-function<span style="color: #00AA00;color: #439AD0;">:</span> ease-in-out<span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>There are two things different here. First I am scaling the size to 1.1 of what the actual size is. This says that when you hover over the &#8216;li&#8217;, make it bigger. Second, I am calling an animation called &#8216;resize&#8217;. NOW for the fun stuff.</p>
<h3>Animations &#8211; Think of Flash frames written out as text commands</h3>
<p>That is exactly what came to mind when I was writing it last night. Remember when I said remember &#8216;resize2&#8242;? Well here are the two actual animations that the li&#8217;s are calling:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #a1a100;color: #439AD0;">@-webkit-keyframes resize {</span>
	<span style="color: #933;">0%</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	-moz-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-o-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
	transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #00AA00;color: #439AD0;">&#125;</span>
  <span style="color: #933;">100%</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
  -moz-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
  -webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
  -o-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
  transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
  <span style="color: #00AA00;color: #439AD0;">&#125;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
<span style="color: #a1a100;color: #439AD0;">@-webkit-keyframes resize2 {</span>
	<span style="color: #933;">0%</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	-moz-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-o-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
	transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #00AA00;color: #439AD0;">&#125;</span>
  <span style="color: #933;">100%</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
  -moz-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
  -webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
  -o-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
  transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
  <span style="color: #00AA00;color: #439AD0;">&#125;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>Looks like a sort of jQuery function or if/else statement&#8230;or something. Either way, it is crazy to look at, and it helps if you think of it as a Flash tween. The first animation, &#8216;resize&#8217;, is actually for the &#8216;li:hover&#8217;, which says at 0% (think frame 1 in Flash) start out at the default size, and at 100% (last frame in Flash animation) make it 10% bigger (the 1.1). The &#8216;resize2&#8242; animation does the exact opposite which is called out on the &#8216;li&#8217; (meaning when you are not hovering on it).</p>
<p>There is one side effect on this and that is that when you reload the page, it starts the animation &#8216;resize2&#8242; because you are not hovering. Doesn&#8217;t bother me, and I find it actually cool so I left it the way it is.</p>
<h3>Now that I&#8217;ve done it, what do I think?</h3>
<p>Ok, I wrote my first actual CSS3 animation. I think it is cool, and I have rolled over it about 50 times just to give myself a pat on the back each time. What is your first thought when looking at all of that? That is a lot of css, isn&#8217;t it? Pretty much what I thought, and that is just to get the social icons to grow big and small on the hover. Now imagine if you have a ton of other crap that you want to do slick little animations to.</p>
<p>What made this a non-thing for me is that Sass and Compass make writing something like this easy. But writing it out like most of you would seems like a serious pain in the ass. I could have written something similar using jQuery in like 5 lines of code and in about 10 minutes. On the one hand I find it cool that this was done using only CSS. On the other, it is only supported in 2 browsers (Chrome and Safari) and 1 Beta&#8230;I hope (FF 4). It does the scaling in FF 3.6, just not the smooth animation. jQuery would have hit all of them.</p>
<p>I am torn between thinking how cool that is, and if something like this should even be in CSS. This goes beyond the basic styling of an element. This is doing some functionality on top, that to me can be more efficiently done in jQuery, so why in the world would I do this again? I will, but it is more of bragging rights than because I should.</p>
<p>My question to you though is two fold: Should CSS be handling this, and if yes, why would you when you could get it done quicker and with less using javascript?</p>
<p>If you want to read more on cool CSS3 animations, transitions and transforms &#8211; I highly recommend <a href="http://css3.bradshawenterprises.com/">this</a>.</p>
<div class="gator">
<a  href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=jcDesigns-" rel="nofollow"><img src="http://tracking.hostgator.com/img/Shared/468x60.gif" border=0></a></p>
<p>Coupon Code: webmachine</p>
</div>
 <img src="http://jc-designs.net/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=642" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://jc-designs.net/blog/2010/11/trying-out-a-simple-css3-animation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A review of the 960 Grid System</title>
		<link>http://jc-designs.net/blog/2010/10/a-review-of-the-960-grid-system/</link>
		<comments>http://jc-designs.net/blog/2010/10/a-review-of-the-960-grid-system/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 20:32:03 +0000</pubDate>
		<dc:creator>jcDesigns</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://jc-designs.net/blog/?p=590</guid>
		<description><![CDATA[Thank god for a good tutorial! NOTE: I am going to review it, not go into detail into how things work &#8211; there are plenty of tutorials on that (one of which is listed below. If not for this tutorial by Joshua Johnson, I will have to admit that the 960gs is terribly confusing. He [...]]]></description>
			<content:encoded><![CDATA[<h3>Thank god for a good tutorial!</h3>
<p><strong><em>NOTE: I am going to review it, not go into detail into how things work &#8211; there are plenty of tutorials on that (one of which is listed below.</em></strong><br />
If not for <a href="http://sixrevisions.com/web_design/the-960-grid-system-made-easy/">this tutorial</a> by Joshua Johnson, I will have to admit that the 960gs is terribly confusing. He explains how the grid works in plain english, and what the push/pull classes do. I started my redesign build last night, and as previously stated before, I was going to try my hand at this whole grid thing. Follow along, and you will see what I think.</p>
<h3>Learning Curve</h3>
<p>Either I&#8217;m an idiot, or the 960gs is way harder than I thought it was going to be. How could I not understand what is going on under the hood from the get go? First, it didn&#8217;t help that I started  with the 16 column while designing in Photoshop, only to realize that I wanted the 24 when I started building it. I am already down for the count, because the grids do not line up the same way, due to there being more margin in the 16 column version.</p>
<p><span id="more-590"></span><br />
One thing that bugs the hell out of me is that the PSD files are at 1020px wide. Why is there nowhere that says why this is. Do I crop it exactly to 960? If so, why not just make the damn thing AT 960px? So what are you supposed to do? I designed it at the 1020px size and lined everything up at the column lines. I had stuff going beyond, but that was pure graphics stuff &#8211; nothing that needed to be lined up. This is the kind of thing that drives me nuts though&#8230;the site itself.</p>
<p>Here is the basic low down on learning how to use the 960 Grid System. The first time you use it, you will say to yourself &#8220;What the #@%#?&#8221; The second time you use it, it will be easier and things will start making a lot more sense. A few times in, and you will be pro. The problem though is that the tutorial I linked to above, was the first one that I actually understood on using some of the classes within the system. The actual site for it is not a great place for documentation.</p>
<h3>Let&#8217;s start with the pros</h3>
<p>I&#8217;ll start with the good stuff first, so you don&#8217;t feel I am trashing the system.</p>
<ul>
<li><strong>CSS</strong> &#8211; once you understand what each class does, it becomes a breeze to make a layout. Full width column for header, grid 10 there, grid 5 there, push this one, and pull that one. The 960gs can really speed up development.</li>
<li><strong>Measurements are done for you</strong> &#8211; No thinking about widths, margins, positions&#8230;everything is calculated for you.</li>
<li><strong>Pre-made templates are great</strong> &#8211; other than the size issues I had in the PS files, they are easy, well done, and very modifiable.</li>
<li><strong>Insane amount of templates</strong> &#8211; Sounds the same but not&#8230;the 960gs not only comes in 12, 16 or 24 column templates, it has all the css, sample code, and there is a template for pretty much every piece of software you could possible use (Photoshop, Illustrator, Indesign, Flash, Fireworks&#8230;and crap I haven&#8217;t heard of).</li>
<li>Templates/Prototypes &#8211; If you are making template based sites or just making a quick prototype, this is where the 960gs shines because of the speed factor.</li>
</ul>
<h3>The stuff I don&#8217;t like</h3>
<p>Please read this knowing that it is my opinion. I am not bashing the 960gs, I am just telling you what I think the pros and cons are.</p>
<ul>
<li><strong>Flexibility</strong> &#8211; If I want to shift things left, I have to modify the CSS. So what? Well, the damn thing is set at very particular sizes, and really, if I am going to have to adjust a bunch of the styles, I might as well have done it myself. A push or pull shoves the container a specified amount. I felt like if I changed the CSS, I was already ditching the grid.</li>
<li><strong>Semantics</strong> &#8211; while this doesn&#8217;t bother me much, if you had to hand this off to someone who didn&#8217;t know the system, they would look at the class names and scratch their head in confusion. I&#8217;m not pro at the semantic thing, but I do try.</li>
<li><strong>Classes</strong> &#8211; you can really start adding a ton of classes to the element you are styling. like &#8220;grid_5 push_1 prefix_2&#8243;&#8230;I am making that up, but you get the picture. I&#8217;ve read &#8220;Ya, but you put an id on it then&#8221;&#8230;so now I&#8217;m just cluttering crap up to make sense out of it?</li>
<li><strong>Extra containers</strong> &#8211; maybe this is just my not having enough experience, but if I put padding on say &#8220;grid_5&#8243;, I have to change the width of grid_5, but that hits all of them, so now I have to add a special class? Or add a container just to do the padding. I feel there is too much potential for divititis using the 960gs.</li>
<li><strong>Unused classes</strong> &#8211; there is going to be a bunch of classes that you will not use during a build, which then means you will most likely go through and weed them out.</li>
</ul>
<h3>Final thoughts</h3>
<p>I&#8217;m glad I tried it out, as it gave me something new to learn. Once you have learned how everything works, the 960gs can really speed up development time. Will I use it for my redesign now that I have worked through it? Not on this redesign. Will I use it for a different project? Yes! I liked it enough to have a full go at it. The photoshop templates alone are good just for design purposes. I feel I have less control over the CSS using the 960gs, but if you use it from the start, and have a clear idea of where you are going, then this is a good tool.</p>
<div class="gator">
<a  href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=jcDesigns-"><img src="http://tracking.hostgator.com/img/Shared/468x60.gif" border=0></a></p>
<p>Coupon Code: webmachine</p>
</div>
 <img src="http://jc-designs.net/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=590" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://jc-designs.net/blog/2010/10/a-review-of-the-960-grid-system/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Basics of CSS3 Transitions and Transforms</title>
		<link>http://jc-designs.net/blog/2010/10/the-basics-of-css3-transitions-and-transforms/</link>
		<comments>http://jc-designs.net/blog/2010/10/the-basics-of-css3-transitions-and-transforms/#comments</comments>
		<pubDate>Thu, 07 Oct 2010 02:41:10 +0000</pubDate>
		<dc:creator>jcDesigns</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://jc-designs.net/blog/?p=583</guid>
		<description><![CDATA[Let&#8217;s talk about support First off, we know for a fact that Safari and Chrome support Transitions, because we&#8217;ve all been using one of them to see the cool crap people have been doing. FireFox 4 will support it and they keep adding to it all the time. IE9, as of what I have read, [...]]]></description>
			<content:encoded><![CDATA[<h3>Let&#8217;s talk about support</h3>
<p>First off, we know for a fact that Safari and Chrome support Transitions, because we&#8217;ve all been using one of them to see the cool crap people have been doing. FireFox 4 will support it and they keep adding to it all the time. <a href="http://www.impressivewebs.com/css3-support-ie9/">IE9</a>, as of what I have read, will not. They are still missing a lot of other things, so this is not surprising. But since it is still too early to tell, who knows what the final product will have. The main thing to know is, if you haven&#8217;t started getting your CSS3 chops down, you should start. It won&#8217;t be long before we are using it on a regular basis. Personally, I use quite a few, but transitions is one that I have stayed away from.</p>
<p><span id="more-583"></span></p>
<h3>The basic syntax</h3>
<p>If you have used CSS3 styles, then you are used to the vendor prefixes. They might be annoying, but they make sense and it just means some additional copying. A simple transition you might have seen is to fade in the background color of a button. Here is what the CSS would look like:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;">a <span style="color: #00AA00;color: #439AD0;">&#123;</span> 
<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">height</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">30px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">text-align</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">center</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">padding</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">15px</span> <span style="color: #cc66cc;color: #439AD0;">0</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">display</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">block</span><span style="color: #00AA00;color: #439AD0;">;</span> 
<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span><span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">background-color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#000000</span><span style="color: #00AA00;color: #439AD0;">;</span>  
-webkit-transition<span style="color: #00AA00;color: #439AD0;">:</span><span style="color: #000000; font-weight: bold;color: #439AD0;">background-color</span> 1s ease-in<span style="color: #00AA00;color: #439AD0;">;</span>  
-moz-transition<span style="color: #00AA00;color: #439AD0;">:</span><span style="color: #000000; font-weight: bold;color: #439AD0;">background-color</span> 1s ease-in<span style="color: #00AA00;color: #439AD0;">;</span>  
-o-transition<span style="color: #00AA00;color: #439AD0;">:</span><span style="color: #000000; font-weight: bold;color: #439AD0;">background-color</span> 1s ease-in<span style="color: #00AA00;color: #439AD0;">;</span>  
transition<span style="color: #00AA00;color: #439AD0;">:</span><span style="color: #000000; font-weight: bold;color: #439AD0;">background-color</span> 1s ease-in<span style="color: #00AA00;color: #439AD0;">;</span>  
<span style="color: #00AA00;color: #439AD0;">&#125;</span> 
&nbsp;
a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">background-color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#ff0000</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>It turns out that I had nothing to be afraid of, and neither should you. Type in the vendor prefix, then the colon, followed by the property you are transitioning, the amount of time you want the transition to take, and finally the type.</p>
<h3>Skew, Scale, Rotate, and Translate</h3>
<p>What? These are simple, yet cool. Ever create a button where the text was set at an angle, but you had to use Photoshop to do it? Well, Rotate will keep the text as actual text, and make it easier to fix if someone needs to change what it is saying. Here is what the CSS would look like for each of these:</p>
<p>Skew:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #6666ff;color: #439AD0;">.box</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
-moz-transform<span style="color: #00AA00;color: #439AD0;">:</span>skew<span style="color: #00AA00;color: #439AD0;">&#40;</span>20deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span>skew<span style="color: #00AA00;color: #439AD0;">&#40;</span>20deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-o-transform<span style="color: #00AA00;color: #439AD0;">:</span>skew<span style="color: #00AA00;color: #439AD0;">&#40;</span>20deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
transform<span style="color: #00AA00;color: #439AD0;">:</span>skew<span style="color: #00AA00;color: #439AD0;">&#40;</span>20deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>Scale &#8211; the numbers are percentages, where 1 = 100%:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #6666ff;color: #439AD0;">.box</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
-moz-transform<span style="color: #00AA00;color: #439AD0;">:</span>scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span>scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-o-transform<span style="color: #00AA00;color: #439AD0;">:</span>scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
transform<span style="color: #00AA00;color: #439AD0;">:</span>scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>Rotate:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #6666ff;color: #439AD0;">.box</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
-moz-transform<span style="color: #00AA00;color: #439AD0;">:</span>rotate<span style="color: #00AA00;color: #439AD0;">&#40;</span>30deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span>rotate<span style="color: #00AA00;color: #439AD0;">&#40;</span>30deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-o-transform<span style="color: #00AA00;color: #439AD0;">:</span>rotate<span style="color: #00AA00;color: #439AD0;">&#40;</span>30deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
transform<span style="color: #00AA00;color: #439AD0;">:</span>rotate<span style="color: #00AA00;color: #439AD0;">&#40;</span>30deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>Translate:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #6666ff;color: #439AD0;">.box</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
-moz-transform<span style="color: #00AA00;color: #439AD0;">:</span>translate<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #933;">100px</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #933;">100px</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span>translate<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #933;">100px</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #933;">100px</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-o-transform<span style="color: #00AA00;color: #439AD0;">:</span>translate<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #933;">100px</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #933;">100px</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
transform<span style="color: #00AA00;color: #439AD0;">:</span>translate<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #933;">100px</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #933;">100px</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>Easy right? Just remember that skew will distort, scale changes size, rotate turns, and translate moves. But what if you want to do more than one transition or transform? That&#8217;s what you want to know now, right? Well, good thing I did the demo that I&#8217;ll link to later, or I wouldn&#8217;t have known. There was a lot of trial and error, smiles and clapping, swearing and finger pointing at the screen, and&#8230;.some discovery.</p>
<h3>You can&#8217;t eat just one!</h3>
<p>First thing to remember: you can only have one transform or transition&#8230;how do I say this without confusing the crap out of you&#8230;property &#8216;line&#8217;. Better if I show you&#8230;</p>
<p>This is the BAD:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;">-webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">,</span><span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span> rotate<span style="color: #00AA00;color: #439AD0;">&#40;</span>30deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span></pre></div></div>

<p>Why is that bad? Oh my god, I just pasted that in, give me a second you impatient lot. Because like every other property, the second one overwrites the first. For some reason I thought the above would be different though. They are different transitions right? Yes, but of course&#8230;no. Here is what it should look like:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;">-webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">,</span><span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> rotate<span style="color: #00AA00;color: #439AD0;">&#40;</span>30deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span></pre></div></div>

<p>There is one main syntax part to note when doing multiple transitions vs transforms: use a space between each different transform, and a comma to seperate each transition. You can view my little demo below (Safari or Chrome at the moment), and immediately after is the CSS for the bottom button.</p>
<p><a href="http://www.jc-designs.net/demo/transition.html">View Demo</a></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #cc00cc;">#backMovement</span> a <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">display</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">block</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">120px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">height</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">padding</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">15px</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #933;">5px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">text-decoration</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">none</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">text-transform</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">uppercase</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-moz-border-radius<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-webkit-border-radius<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	border-radius<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">12px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">border</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#f60</span> <span style="color: #993333;color: #439AD0;">solid</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">text-shadow</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">1px</span> <span style="color: #933;">4px</span> <span style="color: #933;">8px</span> <span style="color: #cc00cc;">#F60</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-moz-box-shadow<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">1px</span> <span style="color: #933;">4px</span> <span style="color: #933;">8px</span> <span style="color: #cc00cc;">#F60</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-webkit-box-shadow<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">1px</span> <span style="color: #933;">4px</span> <span style="color: #933;">8px</span> <span style="color: #cc00cc;">#F60</span><span style="color: #00AA00;color: #439AD0;">;</span>
	box-shadow<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">1px</span> <span style="color: #933;">4px</span> <span style="color: #933;">8px</span> <span style="color: #cc00cc;">#F60</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-moz-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">,</span><span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> rotate<span style="color: #00AA00;color: #439AD0;">&#40;</span>30deg<span style="color: #00AA00;color: #439AD0;">&#41;</span> translate<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> skew<span style="color: #00AA00;color: #439AD0;">&#40;</span>20deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-webkit-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">,</span><span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> rotate<span style="color: #00AA00;color: #439AD0;">&#40;</span>30deg<span style="color: #00AA00;color: #439AD0;">&#41;</span> translate<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> skew<span style="color: #00AA00;color: #439AD0;">&#40;</span>20deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-o-transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">,</span><span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> rotate<span style="color: #00AA00;color: #439AD0;">&#40;</span>30deg<span style="color: #00AA00;color: #439AD0;">&#41;</span> translate<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> skew<span style="color: #00AA00;color: #439AD0;">&#40;</span>20deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
	transform<span style="color: #00AA00;color: #439AD0;">:</span> scale<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">,</span><span style="color: #cc66cc;color: #439AD0;">1.5</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> rotate<span style="color: #00AA00;color: #439AD0;">&#40;</span>30deg<span style="color: #00AA00;color: #439AD0;">&#41;</span> translate<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> skew<span style="color: #00AA00;color: #439AD0;">&#40;</span>20deg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">url</span><span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/grid.jpg</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> <span style="color: #993333;color: #439AD0;">no-repeat</span> <span style="color: #933;">0px</span> <span style="color: #933;">-104px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	-moz-transition<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">background-position</span> 1s<span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">color</span> 1s ease-in<span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">text-shadow</span> 1s ease-in<span style="color: #00AA00;color: #439AD0;">;</span>
	-webkit-transition<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">background-position</span> 1s<span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">color</span> 1s ease-in<span style="color: #00AA00;color: #439AD0;">;</span>
	-o-transition<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">background-position</span> 1s<span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">color</span> 1s ease-in<span style="color: #00AA00;color: #439AD0;">;</span>
	transition<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">background-position</span> 1s<span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">color</span> 1s ease-in<span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#backMovement</span> a<span style="color: #3333ff;">:hover</span><span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background-position</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #cc66cc;color: #439AD0;">0</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#F60</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">text-shadow</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">1px</span> <span style="color: #933;">4px</span> <span style="color: #933;">8px</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<h3>Let&#8217;s wrap this up</h3>
<p>You can obviously see that there is a LOT of lines of css for this stupid button. It&#8217;s not even that great looking and it took 31 lines of CSS (block form of course)! Now, think about this&#8230;you want to add a gradient, use multiple images, and god knows what. I realize that realistically a lot of the CSS would be trimmed off of this button because most likely you are not going to rotate, skew, translate, color change, background position movement and who knows what else I put on there. BUT&#8230;if you think about it, most of that is not that far fetched.</p>
<p>Here is something else to consider. Let&#8217;s say you make the button in Photoshop and it is on an image sprite. Which can you do faster, the CSS method or the image method, and what will the actual file size contribution  be? Meaning which will weigh more? You do still need the background image for the CSS method. What you do save in the long run, is time on any changes.</p>
<p>One thing I like about the making a button this way is that you can have chunks of the CSS stored in snippets, so that if you need a particular part, you don&#8217;t have to write it from scratch every time.</p>
<p>What are your thoughts on this? Let&#8217;s here &#8216;em!</p>
<div class="gator">
<a  href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=jcDesigns-"><img src="http://tracking.hostgator.com/img/Shared/468x60.gif" border=0></a></p>
<p>Coupon Code: webmachine</p>
</div>
<div class="jBox">
<h2 class="jq">jQuery junkBox</h2>
<p><strong>.scroll();</strong><br />
This event is sent to an element when a person scrolls to a different place in the element. Below, a message displays when a person scrolls within an element with the class &#8216;content&#8217;.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;color: #439AD0; font-weight: bold;">$<span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'.content'</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #000066;color: #439AD0;">scroll</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #003366; font-weight: bold;color: #439AD0;">function</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #009900;color: #439AD0;">&#41;</span> <span style="color: #009900;color: #439AD0;">&#123;</span>
<span style="color: #000066;color: #439AD0;">alert</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'You are scrolling'</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span>
<span style="color: #009900;color: #439AD0;">&#125;</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span></pre></div></div>

</div>
 <img src="http://jc-designs.net/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=583" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://jc-designs.net/blog/2010/10/the-basics-of-css3-transitions-and-transforms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Real CSS Mistakes Beginners Make &#8211; A Rebuttal Of Sorts</title>
		<link>http://jc-designs.net/blog/2010/09/real-css-mistakes-beginners-make-a-rebuttal-of-sorts/</link>
		<comments>http://jc-designs.net/blog/2010/09/real-css-mistakes-beginners-make-a-rebuttal-of-sorts/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 18:49:02 +0000</pubDate>
		<dc:creator>jcDesigns</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://jc-designs.net/blog/?p=548</guid>
		<description><![CDATA[I will not concur NOTE: I am not bashing the article, because I think it is well written. This is my opinion on the mistakes listed. Even though I don&#8217;t agree with some, I applaud the author for the piece. A week or so ago, I read an article called &#8220;12 Common CSS Mistakes Web [...]]]></description>
			<content:encoded><![CDATA[<h3>I will not concur</h3>
<p>NOTE: I am not bashing the article, because I think it is well written. This is my opinion on the mistakes listed. Even though I don&#8217;t agree with some, I applaud the author for the piece.</p>
<p>A week or so ago, I read an article called &#8220;<a href="http://sixrevisions.com/css/12-common-css-mistakes-web-developers-make/">12 Common CSS Mistakes Web Developers Make</a>&#8220;, and after reading it for a second time, I find that I don&#8217;t agree with a lot of the article. Frankly, some just are not mistakes, but a person&#8217;s preference. As I move along in my web development career, it becomes more apparent that there is less right vs wrong than people would have you believe.</p>
<p><span id="more-548"></span></p>
<h3>The Zeppelin of Resets</h3>
<p>The author&#8217;s first listed mistake is not using a proper reset. I agree. See? I&#8217;m totally not just bashing. While I find Eric Meyer&#8217;s reset CSS incredibly bloated and insane&#8230;I use it. Why? Because it is better than the one I had made, and it just plain makes sense. If you don&#8217;t know why you would need a reset, or what one is, you will find out in a hurry when you open your site in IE. Man, ul&#8217;s and p tags used to drive me insane. Thank you Eric Meyer for your brilliance because it has saved me countless headaches.</p>
<h3>Now onto what I disagree with</h3>
<p>Ok, here are the ones that I disagree with calling them mistakes. Shorthand CSS. It takes a while to get them down, but once you do, life becomes a little faster. A quick example:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #808080; font-style: italic;color: #439AD0;">/* Non shorthand */</span>
<span style="color: #6666ff;color: #439AD0;">.myClass</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">background-image</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">url</span><span style="color: #00AA00;color: #439AD0;">&#40;</span>../images/photo1.jpg<span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">background-repeat</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">no-repeat</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">background-position</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">left</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;color: #439AD0;">/* Shorthand version */</span>
<span style="color: #6666ff;color: #439AD0;">.myClass</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">url</span><span style="color: #00AA00;color: #439AD0;">&#40;</span>../images/photo1.jpg<span style="color: #00AA00;color: #439AD0;">&#41;</span> <span style="color: #993333;color: #439AD0;">no-repeat</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">left</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>See? Much easier&#8230;but not the point. I don&#8217;t think using long hand is a mistake. To me, the only thing that matters is that you are using the properties correctly. Yes you save file/page weight, but I&#8217;m a fan of <a href="http://jc-designs.net/blog/2010/03/yslow-minify-what-it-did-for-me-now-you/ target="_blank" ">minifing css</a> which could help that out a lot. Plus, for a majority of people, you are not going to be using the thousand lines or more CSS files that I see every day. I&#8217;m just not calling this one bad. I would much rather have a person on my team using longhand rather than just bad css.</p>
<p>Adding &#8216;px&#8217; after the &#8217;0&#8242; in a property&#8217;s value is another of the mistakes listed. Nope. Again, not a mistake. Are you adding small amounts of weight to the page when it is all taken in together? Yes, but I dare you to make a test where you can actually notice the difference. Again, minifing the CSS is going to take care of the major weight killer. I will call this one preference too.</p>
<h3>Who the #$%@ types red?</h3>
<p>Number 6 in the article baffles me. People using the word &#8216;red&#8217; instead of a hex number like &#8216;#ff0000&#8242;. Not because it isn&#8217;t a mistake&#8230;it is, and his reason is correct with how browsers interprets what &#8216;red&#8217; is, but that he thinks people are actually doing this. I&#8217;ve worked with a decent amount of designers and developers not, and the ONLY people I have seen use the color names are programmers. They don&#8217;t care. They throw lime, red, yellow, navy and all sorts of god awful colors on the page just so they know what sections are different, not because they think they are pretty. I just can&#8217;t believe there are people doing this that are being serious in their design. If you are doing a super rough demo&#8230;.maaaaaaybe&#8230;.nope, never mind&#8230;still wouldn&#8217;t happen. I agree its a mistake&#8230;I disagree that people are doing it, and YOU cannot convince me of that. I call bullshit.</p>
<h3>Redundancy</h3>
<p>I feel redundant just by typing that heading. Anyway, he is saying that creating styles that share the same properties is a mistake. Can&#8217;t agree on that either, but this probably has to do with my having to work with content editors that have varying levels of CSS skill. Example of what the author is talking about:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #6666ff;color: #439AD0;">.myClass1</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">font-size</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">14px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">text-align</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">right</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
<span style="color: #6666ff;color: #439AD0;">.myClass2</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">font-size</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">14px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">text-align</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">right</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">border-bottom</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#ff0000</span> <span style="color: #993333;color: #439AD0;">solid</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>It could be condensed to this:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #6666ff;color: #439AD0;">.myClass1</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #6666ff;color: #439AD0;">.myClass2</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">font-size</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">14px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">text-align</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">right</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
<span style="color: #6666ff;color: #439AD0;">.myClass2</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">border-bottom</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#ff0000</span> <span style="color: #993333;color: #439AD0;">solid</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>This falls more into the &#8220;I love writing CSS so much that I repeat things unnecessarily&#8221; than an actual mistake.</p>
<p>Others he lists like &#8220;too much white space&#8221; and &#8220;organizing your CSS in a logical way&#8221;, and using one stylesheet, not mistakes. Here is some redundancy&#8230;minify it (linked to my article about it above)&#8230;gets rid of all the white space. And logical way? I know I am sounding testy here, but I am not bashing his points&#8230;just don&#8217;t agree. Logical to who exactly? Order it any damn way you want, because realistically, we are all addicted to Firebug anyway. I never search through a CSS file, I Firebug what I&#8217;m looking for, find the line and use the shortcut in whatever IDE I am using to Go To Line: whatever. I structure my CSS the same way every time, so I usually have a general idea of where something will be. But one developer&#8217;s logical is another&#8217;s madhouse.</p>
<h3>What I consider actual mistakes &#8211; Negative Margins</h3>
<p>Using negative top margins in an attempt to position something the way you want it. Ever see that? I used to do it when I first got into CSS years ago. Can&#8217;t seem to get a div where it needs to go, so you end up with a top margin of like -240px or something. Bad. Get a handle on <a href="http://jc-designs.net/blog/2010/09/css-positioning-relative-and-absolute/" target="_blank">positioning divs</a> and this will never happen again. IE doesn&#8217;t play nice with the whole negative margin thing. Completely horrible idea, and I see it used all the time.</p>
<h3>Let&#8217;s make everything important so we don&#8217;t know what IS important</h3>
<p>Not everything is as important as people think. No, I mean that literally. I have seen too many uses of  !important on a property, simply because the CSS writer doesn&#8217;t know how to overwrite that particular style. With that stupid !important on there, it becomes a real pain in the ass to change later.</p>
<h3>Margin and Padding usage</h3>
<p>My favorite. Disregard on proper usage of margin or padding. I have seen people use one instead of the other to the point where changing a layout or div position becomes a giant cluster of crap. Don&#8217;t mix and match them to suite your needs, use them properly please! Another actual mistake.</p>
<h3>Root Beer Floats</h3>
<p>I think a lot of newbie web developers/designers do this when they are starting out. They figure out what float does, and then float the hell out of everything. Totally unnecessary and can be hard to change things in a complicated design when everything and its mother is floated. Use it when you need it(and don&#8217;t forget to feed it, can you picture that!), not to make root beer floats out of your page.</p>
<h3>Conclusion of all this</h3>
<p>The author of the original article did a good job at pointing some things out, but I have to disagree on some of the things he calls mistakes. I believe most could be called a preference thing. To me, a mistake is when you are doing something wrong that has the potential to wreck a page, or makes it difficult to change once done.</p>
<p>Anyone out there now any other &#8216;actual&#8217; mistakes? Let me know!</p>
<div class="gator">
<a  href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=jcDesigns-"><img src="http://tracking.hostgator.com/img/Shared/468x60.gif" border=0></a></p>
<p>Coupon Code: webmachine</p>
</div>
 <img src="http://jc-designs.net/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=548" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://jc-designs.net/blog/2010/09/real-css-mistakes-beginners-make-a-rebuttal-of-sorts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Poor Man&#8217;s CSS3 Button</title>
		<link>http://jc-designs.net/blog/2010/09/the-poor-mans-css3-button/</link>
		<comments>http://jc-designs.net/blog/2010/09/the-poor-mans-css3-button/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 19:18:50 +0000</pubDate>
		<dc:creator>jcDesigns</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://jc-designs.net/blog/?p=534</guid>
		<description><![CDATA[I call them Pez I received a tweet the other day about these cool CSS3 buttons called BonBon Buttons. The site says they are named after the French word for candy, but after looking at them, they look like Pez to me. Hmmm&#8230;that is what I will call mine&#8230;Pez! Regardless they are very pretty. Even [...]]]></description>
			<content:encoded><![CDATA[<h3>I call them Pez</h3>
<p>I received a tweet the other day about these cool CSS3 buttons called <a href="http://lab.simurai.com/css/buttons/">BonBon Buttons</a>. The site says they are named after the French word for candy, but after looking at them, they look like Pez to me. Hmmm&#8230;that is what I will call mine&#8230;Pez! Regardless they are very pretty. Even better, the creator of them lists where it won&#8217;t work. He was just tooling around one day and made these buttons. Well, I decided to do the &#8220;poor man&#8217;s version&#8221; of those. And unlike the BonBon buttons, my Pez button will work in IE6 as long as you use <a href="http://css3pie.com/">CSS PIE</a>, with the exception of text-shadow, and the radial gradient. Those two properties don&#8217;t add all that much, and even without them they look good in IE.</p>
<p><span id="more-534"></span><br />
<a href="http://www.jc-designs.net/demo/button.html">View Demo</a></p>
<h3>Are there 4 tons of CSS involved?</h3>
<p>There is well over 100 lines of CSS in the BonBon version, so I wanted to reduce that amount to something close to manageable. It still looks good, but I had to cut a bunch  of stuff out. Here is a look at the actual CSS code for my button.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;">a <span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">position</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">relative</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">font-size</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">24px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">font-weight</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">bold</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">font-family</span><span style="color: #00AA00;color: #439AD0;">:</span> Arial<span style="color: #00AA00;color: #439AD0;">,</span> Helvetica<span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #993333;color: #439AD0;">sans-serif</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">color</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#76A14B</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">text-decoration</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">none</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">text-align</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">center</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-border-radius<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">25px</span> <span style="color: #933;">10px</span> <span style="color: #933;">25px</span> <span style="color: #933;">10px</span><span style="color: #00AA00;color: #439AD0;">;</span>
-moz-border-radius<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">25px</span> <span style="color: #933;">10px</span> <span style="color: #933;">25px</span> <span style="color: #933;">10px</span><span style="color: #00AA00;color: #439AD0;">;</span>
border-radius<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">25px</span> <span style="color: #933;">10px</span> <span style="color: #933;">25px</span> <span style="color: #933;">10px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">border</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">2px</span> <span style="color: #993333;color: #439AD0;">solid</span> <span style="color: #cc00cc;">#BFE599</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">padding</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">10px</span> <span style="color: #933;">20px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">display</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">block</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">margin</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #993333;color: #439AD0;">auto</span><span style="color: #00AA00;color: #439AD0;">;</span>
-moz-box-shadow<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">6px</span> <span style="color: #933;">0px</span> <span style="color: #cc00cc;">#76a14b</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #933;">12px</span> <span style="color: #933;">9px</span> <span style="color: #cc00cc;">#666666</span><span style="color: #00AA00;color: #439AD0;">;</span>
-webkit-box-shadow<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">6px</span> <span style="color: #933;">0px</span> <span style="color: #cc00cc;">#76a14b</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #933;">12px</span> <span style="color: #933;">9px</span> <span style="color: #cc00cc;">#666666</span><span style="color: #00AA00;color: #439AD0;">;</span>
box-shadow<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">6px</span> <span style="color: #933;">0px</span> <span style="color: #cc00cc;">#76a14b</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">0</span> <span style="color: #933;">12px</span> <span style="color: #933;">9px</span> <span style="color: #cc00cc;">#666666</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">text-shadow</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">5px</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;color: #439AD0;">;</span>
behavior<span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">url</span><span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #ff0000; font-style: italic;">images/PIE.htc</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
<span style="color: #6666ff;color: #439AD0;">.glassy</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> -moz-radial-gradient<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #993333;color: #439AD0;">center</span> <span style="color: #000000; font-weight: bold;color: #439AD0;">top</span> <span style="color: #00AA00;color: #439AD0;">,</span> ellipse farthest-corner<span style="color: #00AA00;color: #439AD0;">,</span> rgba<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">255</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">255</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">255</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">0.7</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> <span style="color: #933;">0%</span><span style="color: #00AA00;color: #439AD0;">,</span> rgba<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">255</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">255</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">255</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">0</span><span style="color: #00AA00;color: #439AD0;">&#41;</span> <span style="color: #933;">100%</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">,</span> -moz-linear-gradient<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc00cc;">#CCFF99</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc00cc;">#99CC66</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">background-image</span><span style="color: #00AA00;color: #439AD0;">:</span> -webkit-gradient<span style="color: #00AA00;color: #439AD0;">&#40;</span>radial<span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">100</span> <span style="color: #cc66cc;color: #439AD0;">100</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">32</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">118</span> <span style="color: #cc66cc;color: #439AD0;">118</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">15</span><span style="color: #00AA00;color: #439AD0;">,</span> from<span style="color: #00AA00;color: #439AD0;">&#40;</span>rgba<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc66cc;color: #439AD0;">255</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">255</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">255</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc66cc;color: #439AD0;">0</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">,</span> to<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">,</span> -webkit-gradient<span style="color: #00AA00;color: #439AD0;">&#40;</span>linear<span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #933;">0%</span> <span style="color: #933;">0%</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #933;">0%</span> <span style="color: #933;">100%</span><span style="color: #00AA00;color: #439AD0;">,</span> from<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc00cc;">#CCFF99</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">,</span> to<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #cc00cc;">#99CC66</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
-pie-<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> linear-gradient<span style="color: #00AA00;color: #439AD0;">&#40;</span><span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc00cc;">#CCFF99</span><span style="color: #00AA00;color: #439AD0;">,</span> <span style="color: #cc00cc;">#99CC66</span><span style="color: #00AA00;color: #439AD0;">&#41;</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>The glassy part adds the background gradients as well as white radial gradient at the top of the button. So I reduced it down to like 30 lines of CSS for a pretty cool button.There are a few things to note:</p>
<p>1) As stated before, you MUST use CSS Pie for this to work in IE.</p>
<p>2) Ignore the webkit radial gradient, because I didn&#8217;t figure out how to do it correctly. Webkit&#8217;s syntax is a pain in the ass, so I just didn&#8217;t get it working correctly. If anyone wants to get that part done and post it, that would be great.</p>
<p>3) For IE6 to work, the &#8216;a&#8217; tag MUST be positioned relative. The effects get blow away if you do not.</p>
<h3>Final thoughts on this little experiment</h3>
<p>The really cool part for me about doing this, is that I&#8217;ve used two things/techniques from my previous posts. I&#8217;m using CSS Pie, and using multiple box-shadows on an element, which I wrote about <a href="http://jc-designs.net/blog/2010/08/css3-just-when-you-thought-you-knew-it-all/" target="_blank">here</a>.</p>
<p>I really like taking other people&#8217;s code, and seeing if I can do it with less code. Granted, here I am leaving some things out, but the overall effect comes through. My Pez button still looks like candy, and it didn&#8217;t take a vast amount of CSS to work. Would I use this button myself rather than cut images? Actually, with it pre-made, yes. If it wasn&#8217;t, then no. It took me a while to get everything the way I wanted it, and you just can&#8217;t waste that much creating a single button. So in production, I would have Sliced &#8216;n&#8217; Diced an image. Now, if you had a library of pre-made, small weight budget CSS3 buttons, then I might start using these types of things more often. Maybe I&#8217;ll start one and throw it out for you guys.</p>
<p>Take the code above and have fun with it. If you come up with something better, let me know!</p>
<div class="gator">
<a  href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=jcDesigns-"><img src="http://tracking.hostgator.com/img/Shared/468x60.gif" border=0></a></p>
<p>Coupon Code: webmachine</p>
</div>
 <img src="http://jc-designs.net/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=534" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://jc-designs.net/blog/2010/09/the-poor-mans-css3-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Positioning &#8211; Relative and Absolute</title>
		<link>http://jc-designs.net/blog/2010/09/css-positioning-relative-and-absolute/</link>
		<comments>http://jc-designs.net/blog/2010/09/css-positioning-relative-and-absolute/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 02:50:14 +0000</pubDate>
		<dc:creator>jcDesigns</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://jc-designs.net/blog/?p=530</guid>
		<description><![CDATA[It takes all types There are four types of positioning: static, fixed, relative, and absolute. Static is the default position state which means it isn&#8217;t positioned. It goes where it normally would on the page. Fixed is positioned relative to the browser window, and won&#8217;t move even if the window is scrolled. Relative positioning allows [...]]]></description>
			<content:encoded><![CDATA[<h3>It takes all types</h3>
<p>There are four types of positioning: static, fixed, relative, and absolute. Static is the default position state which means it isn&#8217;t positioned. It goes where it normally would on the page. Fixed is positioned relative to the browser window, and won&#8217;t move even if the window is scrolled. Relative positioning allows you to use the top, right, bottom, and left CSS properties to position an element relative to where it would appear in the document. Absolute is the tricky one, because it is basically removed from the document, and placed EXACTLY where you want it to go.</p>
<h3>A note on :relative</h3>
<p>If you position something relative, and then use top and left to shift it over, don&#8217;t expect everything below it to shift as well. It still occupies the space in the document normally, you are just shifting it from its initial placement.</p>
<p><span id="more-530"></span></p>
<h3>Let&#8217;s take a look</h3>
<p><strong>View the following demos to get a clearer picture of what I am talking about</strong>.</p>
<p>When you position something absolute, you need to remember that it is removed from the flow of the document &#8211; everything else will ignore it. The element is positioned relative to the first parent element that has a position other than static, if there are none, it will use <html>. If that is the case, and you set the element&#8217;s top and left to 0, it will appear at the very top left edge of the window. No matter how you resize that window, that element will always be at the very top left. Take a look at what we would have.</p>
<p><a href="http://www.jc-designs.net/demo/position1.html">View Demo</a></p>
<p>Here is what the css looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #cc00cc;">#one</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">966px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#999999</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">margin</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">40px</span> <span style="color: #993333;color: #439AD0;">auto</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#two</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">position</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">absolute</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">0</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">left</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">0</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#ff0000</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">height</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<h3>How to put it where you want it</h3>
<p>Let&#8217;s say though, that you want an element in a specific spot that shows exactly where you want it all the time. Easy. Position one of its parents to relative!</p>
<p><a href="http://www.jc-designs.net/demo/position2.html">View Demo</a></p>
<p>Here is what the css would look like:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #cc00cc;">#one</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">position</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">relative</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">966px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#999999</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">margin</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">40px</span> <span style="color: #993333;color: #439AD0;">auto</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#two</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">position</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">absolute</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">left</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">500px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#ff0000</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">height</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>All that was changed, was adding position: relative to div #one, and changing the top and left numbers to div 2. Change them to 0 using Firebug, and you will see that 0 means positioned at the top left of div #one now.</p>
<h3>One is never enough</h3>
<p>Ooohhhh&#8230;I get it, you can&#8217;t just have one. You want another div there positioned absolutely. AND&#8230;you want this new div to appear under the red one.</p>
<p><a href="http://www.jc-designs.net/demo/position3.html">View Demo</a></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #cc00cc;">#one</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">position</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">relative</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">966px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#999999</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #000000; font-weight: bold;color: #439AD0;">margin</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">40px</span> <span style="color: #993333;color: #439AD0;">auto</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#two</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">position</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">absolute</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">left</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">500px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#ff0000</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">height</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">z-index</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc66cc;color: #439AD0;">2</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#three</span> <span style="color: #00AA00;color: #439AD0;">&#123;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">position</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #993333;color: #439AD0;">absolute</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">top</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">85px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">left</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">550px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">background</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #cc00cc;">#999900</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">width</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">200px</span><span style="color: #00AA00;color: #439AD0;">;</span>
	<span style="color: #000000; font-weight: bold;color: #439AD0;">height</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">50px</span><span style="color: #00AA00;color: #439AD0;">;</span>
<span style="color: #00AA00;color: #439AD0;">&#125;</span></pre></div></div>

<p>All I changed there, aside from adding the styles for div #three, is add z-index to div #two. It doesn&#8217;t matter what order the absoluted divs are in, just what z-index they have. Whichever element has the higher z-index, will show on top.</p>
<h3>Closing thoughts</h3>
<p>CSS positioning is actually very easy. Once you know how to use them, figuring out why an element isn&#8217;t positioned the way you thought it would be, becomes a lot easier, too. I can&#8217;t think of a time where I have used :fixed, but :relative and :absolute are thrown around enough that it is a must to learn if you haven&#8217;t yet. Hopefully now, you get a more clear picture of what they do, and how to control them! Let me know if you have any questions.</p>
<div class="gator">
<a  href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=jcDesigns-"><img src="http://tracking.hostgator.com/img/Shared/468x60.gif" border=0></a></p>
<p>Coupon Code: webmachine</p>
</div>
 <img src="http://jc-designs.net/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=530" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://jc-designs.net/blog/2010/09/css-positioning-relative-and-absolute/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSS3 &#8211; Just When You Thought You Knew It All</title>
		<link>http://jc-designs.net/blog/2010/08/css3-just-when-you-thought-you-knew-it-all/</link>
		<comments>http://jc-designs.net/blog/2010/08/css3-just-when-you-thought-you-knew-it-all/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 03:09:30 +0000</pubDate>
		<dc:creator>jcDesigns</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://jc-designs.net/blog/?p=520</guid>
		<description><![CDATA[You can do that? So I read an article today that I thought was going to suck. Nope, I was wrong. While I knew most of it, there was one thing that popped out at me today. See? Learnin&#8217; all the time! CSS3 has some cool stuff that is easier to do than opening up [...]]]></description>
			<content:encoded><![CDATA[<h3>You can do that?</h3>
<p>So I read an article today that I thought was going to suck. Nope, I was wrong. While I knew most of it, there was one thing that popped out at me today. See? Learnin&#8217; all the time! CSS3 has some cool stuff that is easier to do than opening up Photoshop and creating an image for it. If you got my tweet today, which most of my subscribers didn&#8217;t because you don&#8217;t follow me on twitter (<a href="http://twitter.com/jcDesig">FOLLOW ME!</a>), then you have an inkling of what I am talking about.</p>
<p><span id="more-520"></span><br />
Text-shadow is a really good addition to CSS, I use it on my titles and what-not, and with the use of blur on them, it creates a nice subtle effect. What I did NOT know, is that you can have multiple shadows on the text, adding more awesome to the already kick ass property. Let me show you what the styles look like.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;color: #439AD0; font-weight: bold;"><span style="color: #000000; font-weight: bold;color: #439AD0;">text-shadow</span><span style="color: #00AA00;color: #439AD0;">:</span> <span style="color: #933;">4px</span> <span style="color: #933;">-2px</span> <span style="color: #933;">11px</span> <span style="color: #cc00cc;">#0033FF</span><span style="color: #00AA00;color: #439AD0;">,</span>
	<span style="color: #933;">2px</span> <span style="color: #933;">-7px</span> <span style="color: #933;">10px</span> <span style="color: #cc00cc;">#00CCFF</span><span style="color: #00AA00;color: #439AD0;">,</span>
	<span style="color: #933;">5px</span> <span style="color: #933;">-8px</span> <span style="color: #933;">26px</span> <span style="color: #cc00cc;">#00CCCC</span><span style="color: #00AA00;color: #439AD0;">,</span>
	 <span style="color: #933;">4px</span> <span style="color: #933;">6px</span> <span style="color: #933;">9px</span> <span style="color: #cc00cc;">#999999</span><span style="color: #00AA00;color: #439AD0;">;</span></pre></div></div>

<p><a href="http://www.jc-designs.net/demo/shadow.html">VIEW DEMO</a></p>
<h3>Yep! You read that right, there are 4 shadows going on there</h3>
<p>Holy hell, 4 text-shadows thrown on to create, while not a stellar looking effect, a crazy looking block of text. You know what is even more nuts than that? Can you guess? GOOD JOB! You guys are smarter than I thought, and you are right. You can add as many text-shadows as you want on that thing, seperated by commas. Not only that, but you can do the same thing for box shadows.</p>
<p>This just proves that there is always something new to learn about the things you think are are good at. Obviously I won&#8217;t be using this type of effect all that much, but it altered my way of thinking about CSS3 a little. If I can do this&#8230;maybe I can do something else that I didn&#8217;t think of. </p>
<p>Any other CSS3 stuff you guys know that others might not? Let us know here!</p>
<p>Oh, and I styled the demo buttons finally. Always adding stuff here.</p>
<div class="gator">
<a  href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=jcDesigns-"><img src="http://tracking.hostgator.com/img/Shared/468x60.gif" border=0></a></p>
<p>Coupon Code: webmachine</p>
</div>
<div class="jBox">
<h2 class="jq">jQuery junkBox</h2>
<p><strong>(:only-child)</strong><br />
This selector will get elements that are the only child of its parent. Below will get all &#8216;p&#8217; tags that are the only child of their parents.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;color: #439AD0; font-weight: bold;">$<span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'p:only-child'</span><span style="color: #009900;color: #439AD0;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;color: #439AD0;">&#40;</span><span style="color: #3366CC;color: #439AD0;">'highlight'</span><span style="color: #009900;color: #439AD0;">&#41;</span><span style="color: #339933;color: #439AD0;">;</span></pre></div></div>

</div>
 <img src="http://jc-designs.net/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=520" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://jc-designs.net/blog/2010/08/css3-just-when-you-thought-you-knew-it-all/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

