<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0"><channel><title>CSS-Tricks</title> <link>http://css-tricks.com</link> <description>Tips, Tricks, and Techniques on using Cascading Style Sheets.</description> <lastBuildDate>Fri, 12 Mar 2010 14:03:35 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/CssTricks" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="csstricks" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">CssTricks</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item><title>New Poll: Server Side Languages</title><link>http://css-tricks.com/new-poll-server-side-languages/</link> <comments>http://css-tricks.com/new-poll-server-side-languages/#comments</comments> <pubDate>Fri, 12 Mar 2010 14:01:43 +0000</pubDate> <dc:creator>Chris Coyier</dc:creator> <category><![CDATA[Article]]></category><guid isPermaLink="false">http://css-tricks.com/?p=5889</guid> <description><![CDATA[A bit of a cookie-cutter poll this time, but sometimes those lead to the biggest and most interesting discussions. This is for the folks around here who are more of web developers than web designers: What is your server-side language of choice? Poll is on the site in the sidebar for your voting pleasure. I know many of [...]]]></description> <content:encoded><![CDATA[<p>A bit of a cookie-cutter poll this time, but sometimes those lead to the biggest and most interesting discussions. This is for the folks around here who are more of web developers than web designers:</p><blockquote><p>What is your server-side language of choice?</p></blockquote><p>Poll is on the site in the sidebar for your voting pleasure.</p><p>I know many of you probably know multiple languages. Some of you probably are forced to write in particular languages for you job. For this poll, choose the language that you actually <em>like</em> the most.</p><p><span id="more-5889"></span></p><p>And yes, I know the are more choices than in the list, that&#8217;s what &#8220;Other&#8221; is for, and I&#8217;d love to hear what those others are and why you prefer that language. For example, I&#8217;ve been hearing more and more about server-side JavaScript. Also if it&#8217;s not obvious, this is sans-framework. If you like Rails, clearly that&#8217;s Ruby. Django is Python. CodeIgnitor is PHP. Etc, etc.</p> ]]></content:encoded> <wfw:commentRss>http://css-tricks.com/new-poll-server-side-languages/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Poll Results: Punctuation Inside or Out?</title><link>http://css-tricks.com/poll-results-puncation/</link> <comments>http://css-tricks.com/poll-results-puncation/#comments</comments> <pubDate>Thu, 11 Mar 2010 13:00:07 +0000</pubDate> <dc:creator>Chris Coyier</dc:creator> <category><![CDATA[Article]]></category><guid isPermaLink="false">http://css-tricks.com/?p=5876</guid> <description><![CDATA[Quite a lot of people weighed in on this poll that went out in January. The question was: Should tags like em and strong go &#60;em>(outside)&#60;/em> punctuation characters, or (&#60;strong>inside them&#60;/strong>)? Like many polls around here, the question was interesting and stirred up some great conversation, but the question itself was probably flawed. There were only two [...]]]></description> <content:encoded><![CDATA[<p>Quite a lot of people weighed in on this poll that went out <a href="http://css-tricks.com/new-poll-tagpunctuation-placement/">in January</a>. The question was:</p><blockquote><p>Should tags like em and strong go &lt;em>(outside)&lt;/em> punctuation characters, or (&lt;strong>inside them&lt;/strong>)?</p></blockquote><p>Like many polls around here, the question was interesting and stirred up some great conversation, but the question itself was probably flawed. There were only two choices: outside and inside, referring to placement of the HTML tags. So if &#8220;outside&#8221;, in the example in the question above, the parentheses would be italicized by the &lt;em> tags. If &#8220;inside&#8221;, in the same example above, the parentheses would be regular text and the text inside them would be bolded by the &lt;strong> tags.</p><p>What I was expecting was someone to chime in with the <em>&#8220;absolute official rules on the right way to do it according to the typographic gods of the land.&#8221;</em> That didn&#8217;t really happen. Instead the general consensus was <em>&#8220;it depends.&#8221;</em></p><p>As for the poll results, at the time of this writing, 6,261 people have voted and the results are 55% in favor of &#8220;inside&#8221;:</p><p><img src="http://css-tricks.com/wp-content/csstricks-uploads/insideoutsideresults.png" width="570" height="150" alt="" title="" /></p><p><span id="more-5876"></span></p><h3>It depends&#8230;</h3><p>The following examples are still debatable, but these feel like the most correct way to go, as agreeded upon by most commenters in the original poll article.</p><div class="example"> Come and see me &lt;em>today&lt;/em>!</div><p>The punctuation is left outside of the tag because the word &#8220;today&#8221; alone is what is being emphasized.</p><hr /><div class="example"> &lt;em>Holy Crap!&lt;/em> That’s a really cool blog post.</div><p>The punctuation is inside, because the whole phrase &#8220;Holy Crap!&#8221; is what is being emphasized.</p><hr /><div class="example"> Goat heads (&lt;em>see page 85&lt;/em>) are very nutritious.</div><p>There is split evidence on this one. Some would say that because that whole phrase is an &#8220;injection&#8221; into the sentence is should be grouped with the tag (outside) and all emphasized. Other more official sources say parentheses should never be emphasized. Personally I&#8217;d go outside. Seems like there could be awkward typography tension with the last letter being italic butting up against and upright parentheses.</p><hr /><div class="example"> The books title was &lt;em>Gimme! Gimme! Gimme!&lt;/em></div><p>Punctuation in book titles always go inside the tags.</p><hr /><div class="example"> Was that really Meg Ryan in &lt;em>Cherry 2000&lt;/em>?</div><p>Again it&#8217;s the title alone being emphasized, so having the question mark outside is the general consensus. I feel weird on this one, for some reason I like the opposite when it ends a sentence like this and prefer seeing the question mark follow suite with the previous words. This is a case where actually &lt;i> may be more appropriate&#8230;</p><h3>HTML5 and &lt;b> &#038; &lt;i></h3><p>Ever since I&#8217;ve been a web designer I&#8217;ve been scoffing at the use of the deprecated &lt;b> and &lt;i> tags and dutifully fixing them with the more semantic &lt;strong> and &lt;em> tags. This always made sense to me as we are applying emphasis with these tags, not any specific styling. For example, you might want to leave the text roman for a strong tag but apply a background behind it instead to call it out.</p><p>But now that we are pretty much ready to rock with HTML5, we see the &lt;b> and &lt;i> tags return. WTF, you ask? Well, that&#8217;s what I thought, until you read up and think on it a bit. HTML5 is not replacing strong and em, these are just coming back in addition to them, and all four will live in harmony. In general, you&#8217;ll still use em and strong to emphasize words in text, but you should use b and i <em>when you are bolding for the sake of bolding or italicizing for the sake of italicizing</em>.</p><p>For example, book titles in text should be italicized. Not emphasized, italicized. That is a case of italicizing for the sake of italicizing and makes more sense to use the &lt;i> tag.</p> ]]></content:encoded> <wfw:commentRss>http://css-tricks.com/poll-results-puncation/feed/</wfw:commentRss> <slash:comments>20</slash:comments> </item> <item><title>CSS Off Update</title><link>http://css-tricks.com/css-off-update-2/</link> <comments>http://css-tricks.com/css-off-update-2/#comments</comments> <pubDate>Wed, 10 Mar 2010 13:23:15 +0000</pubDate> <dc:creator>Chris Coyier</dc:creator> <category><![CDATA[Article]]></category><guid isPermaLink="false">http://css-tricks.com/?p=5869</guid> <description><![CDATA[I was telling everyone to check back Wednesday for CSS Off results. Well&#8230; #facepalm. Huge apologies, we still aren&#8217;t quite ready. As it turns out judging 136 entries is quite a huge task. The important bit: come hell or high water, results will be posted Monday. You&#8217;ll be able to browse all the entries and [...]]]></description> <content:encoded><![CDATA[<p>I was telling everyone to check back Wednesday for CSS Off results. Well&#8230; #facepalm. Huge apologies, we still aren&#8217;t quite ready. As it turns out judging 136 entries is quite a huge task. The important bit: come hell or high water, <strong>results will be posted Monday</strong>. You&#8217;ll be able to browse all the entries and see how we scored each based on the criteria we chose. So between the organization, initial judging, top entries judging, and crafting the results page&#8230;  it has been a long road. Not to mention we didn&#8217;t anticipate so many entries! Anyway, no more excuses, see you Monday with results.</p><p>I got a nice card from Doctors Without Borders from the donation made based on the number of entries, so in the meantime we can all feel good about that =).</p> ]]></content:encoded> <wfw:commentRss>http://css-tricks.com/css-off-update-2/feed/</wfw:commentRss> <slash:comments>16</slash:comments> </item> <item><title>Rabble Rabble Rabble!</title><link>http://css-tricks.com/rabble-rabble-rabble/</link> <comments>http://css-tricks.com/rabble-rabble-rabble/#comments</comments> <pubDate>Tue, 09 Mar 2010 16:50:24 +0000</pubDate> <dc:creator>Chris Coyier</dc:creator> <category><![CDATA[Article]]></category><guid isPermaLink="false">http://css-tricks.com/?p=5865</guid> <description><![CDATA[CSS3 is a big mess! 4+ rules for making a corner round or adding a drop shadow! Preposterous! Where are the standards?! I&#8217;ve been hearing a ton of that. There is something of a point here. We all like standards, no question they are a good thing for the industry. Seeing a bunch of messy/repeated code [...]]]></description> <content:encoded><![CDATA[<blockquote><p>CSS3 is a big mess! <a href="http://css3please.com/">4+ rules</a> for making a corner round or adding a drop shadow! Preposterous! Where are the standards?!</p></blockquote><p>I&#8217;ve been hearing a ton of that. There is something of a point here. We all like standards, no question they are a good thing for the industry. Seeing a bunch of messy/repeated code like CSS3 can produce doesn&#8217;t feel like the clean happy code that standards is supposed to be all about.</p><p>But here is the deal.</p><p>The specs for these things aren&#8217;t done yet. Standards move frigging slowly. Browser vendors know we want this stuff, so they don&#8217;t wait for the spec, the use vendor-specific CSS attributes so we can start using/testing them now. This is good. It means they aren&#8217;t sitting on their asses waiting for a slow train that answers to no one. When the spec does get finished, they can roll out support for it in the standard way much quicker.</p><p>In my opinion, it would be <em>worse</em> for browsers to implement the new attributes without the vendor-specific prefixes, as that would <em>actually</em> be abandoning standards.</p> ]]></content:encoded> <wfw:commentRss>http://css-tricks.com/rabble-rabble-rabble/feed/</wfw:commentRss> <slash:comments>31</slash:comments> </item> <item><title>Updates / Links</title><link>http://css-tricks.com/updates-links/</link> <comments>http://css-tricks.com/updates-links/#comments</comments> <pubDate>Tue, 09 Mar 2010 14:04:25 +0000</pubDate> <dc:creator>Chris Coyier</dc:creator> <category><![CDATA[Article]]></category><guid isPermaLink="false">http://css-tricks.com/?p=5859</guid> <description><![CDATA[If you were interested in that CSS Tabs stuff from yesterday, check out the new demo. I got a little obsessed with it and tried out a bunch more things. Still nothing I&#8217;d call a 100% perfect replacement to using JavaScript for tabs, but getting a lot cleaner and closer. I&#8217;m sure most of you read [...]]]></description> <content:encoded><![CDATA[<p>If you were interested in that CSS Tabs stuff from yesterday, <a href="http://css-tricks.com/examples/CSSTabs/">check out the new demo</a>. I got a little obsessed with it and tried out a bunch more things. Still nothing I&#8217;d call a 100% perfect replacement to using JavaScript for tabs, but getting a lot cleaner and closer.</p><p>I&#8217;m sure most of you read these sites anyway, but just in case&#8230;</p><p><span id="more-5859"></span></p><p>I thought Nettuts ran a pretty sweet article about jQuery and it&#8217;s <a href="http://net.tutsplus.com/tutorials/javascript-ajax/uncovering-jquerys-hidden-features/">hidden features</a> by James Padolsey. For example, I always forget how awesomely easy it is to serialize from inputs (like for AJAX submission). Serialize = find all the inputs in the form and build a query string with the name/value pairs, instead of doing all that yourself/hard coding it.</p><p>Then Smashing Magazine ran a great one by Andy Rutledge answering <a href="http://www.smashingmagazine.com/2010/03/08/common-questions-about-design-professionalism/">common questions about design professionalism</a>. Andy is an opinionated dude and I love how he dished out some hard facts here. For example, if you are asking questions like &#8220;I&#8217;m just staring freelancing and I&#8217;m wondering how I can get more clients&#8230;&#8221; then you probably shouldn&#8217;t be freelancing. Plus, a heaping helping of personal responsibility.</p><p>Jeff Starr over on Digging Into WordPress wrote up a nice guide on <a href="http://digwp.com/2010/03/add-plugin-to-wordpress-plugin-repository/">getting a plugin into the official plugin repository</a>. I&#8217;m a little disappointed in myself I&#8217;ve never done this before. I&#8217;m not much of a deep backend dude, but still, I have a few ideas that I think would make cool plugins.</p><p>I&#8217;m gonna close comments here just because anything that needs to be said about any of these things is probably best said at that article.</p> ]]></content:encoded> <wfw:commentRss>http://css-tricks.com/updates-links/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>CSS3-Only Tabbed Area</title><link>http://css-tricks.com/css3-tabs/</link> <comments>http://css-tricks.com/css3-tabs/#comments</comments> <pubDate>Mon, 08 Mar 2010 14:53:13 +0000</pubDate> <dc:creator>Chris Coyier</dc:creator> <category><![CDATA[Article]]></category><guid isPermaLink="false">http://css-tricks.com/?p=5841</guid> <description><![CDATA[When you think of &#8220;tabs&#8221;, your mind might go right to JavaScript. Watch for a click on a tab, hide all the panels, show the one corresponding to tab just clicked on. All major JavaScript libraries tackle tabs in some way. But there is a way to accomplish this same idea with &#8220;pure CSS&#8221;. Just [...]]]></description> <content:encoded><![CDATA[<p>When you think of &#8220;tabs&#8221;, your mind might go right to JavaScript. Watch for a click on a tab, hide all the panels, show the one corresponding to tab just clicked on. All major JavaScript libraries tackle tabs in some way. But there is a way to accomplish this same idea with &#8220;pure CSS&#8221;. Just as we did with the <a href="http://css-tricks.com/video-screencasts/82-css-image-switcher/">CSS Image Switcher</a>, let&#8217;s tackle this traditionally JavaScript project with only CSS.</p><div class="image-wrap"> <img src="http://css-tricks.com/wp-content/csstricks-uploads/csstabsexample.png" width="497" height="141" alt="" title="" /><br /> Tabs: a ubiquitous design pattern</div><p><span id="more-5841"></span></p><h3>:target pseudo class selector</h3><p>The major empowering concept here is the CSS pseudo selector :target. :target is used in conjunction with ID selectors. The selector will match when the current URL contains a hash-tag of that exact ID. So if the current URL is:</p><p>http://css-tricks.com/#big-bam-boom</p><p>And there was an element with that ID on the page:</p><pre><code class="html">&lt;h1 id="big-bam-boom"&gt;Kaplow!&lt;/h1&gt;</code></pre><p>Then this selector will match:</p><pre><code class="css">#big-bam-boom:target { color: red; }</code></pre><p>How does one get to a URL with such a hash tag? You have links that activate them:</p><pre><code class="html">&lt;a href="#big-bam-boom"&gt;Mission Control, we're a little parched up here.&lt;/a&gt;</code></pre><h3>Browser Support / CSS3</h3><p>Normally I might end a tutorial like this with a little section on browser support. But it&#8217;s rather important in this case so let&#8217;s get it out of the way now. :target is considered CSS3. It has wide support across all the major current browsers. Of course I&#8217;m all abut dropping support for IE 6, so who cares if it doesn&#8217;t work in that (it doesn&#8217;t), but :target is also not supported in IE 7 or 8. These browsers are still very much on the radar, which puts this whole tutorial in a fun/educational category rather than a use-this-in-live-production category.</p><p>Of course, if you wanted to use it in production, one option would be to use <a href="http://css-tricks.com/how-to-create-an-ie-only-stylesheet/">conditional comments</a> to add JavaScript to make them to work. We won&#8217;t specifically cover that here.</p><h3>Clean HTML</h3><p>Let&#8217;s start this out right with some nice and clean HTML markup for our soon-to-be tabbed area:</p><pre><code class="html">&lt;div class="tabbed-area"&gt;

	&lt;ul class="tabs group"&gt;
	    &lt;li&gt;&lt;a href="#box-one"&gt;Tab 1&lt;/a&gt;&lt;/li&gt;
	    &lt;li&gt;&lt;a href="#box-two"&gt;Tab 2&lt;/a&gt;&lt;/li&gt;
	    &lt;li&gt;&lt;a href="#box-three"&gt;Tab 3&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;

	&lt;div class="box-wrap"&gt;

		&lt;div id="box-one"&gt;
		  &lt;!-- box two content --&gt;
		&lt;/div&gt;

		&lt;div id="box-two"&gt;
		  &lt;!-- box two content --&gt;
		&lt;/div&gt;

		&lt;div id="box-three"&gt;
		  &lt;!-- box two content --&gt;
		&lt;/div&gt;

	&lt;/div&gt;

&lt;/div&gt;</code></pre><p>I&#8217;d call that perfectly clean. Even with CSS disabled, you would see a list of links each of which would jump down the page to the div with the content related to that link.</p><h3>CSS</h3><p>The tabs themselves we&#8217;ll set up as a horizontal row of links.</p><pre><code class="css">.tabs { list-style: none; }
.tabs li { display: inline; }
.tabs li a { color: black; float: left; display: block; padding: 4px 10px; margin-left: -1px; position: relative; left: 1px; background: white; text-decoration: none; }
.tabs li a:hover { background: #ccc; }</code></pre><p>When you float all the links like that, the parent will collapse, so let&#8217;s chuck in the old clearfix class so we can use it on the parent <tt>ul</tt> so it has a natural height. No need for the IE 6 and 7 hacks here, since neither of those support this technique anyway.</p><pre><code class="css">.group:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; }</code></pre><p>Now let&#8217;s set up the very basic styling for the panels. There is a wrapping div for all the panels. The purpose of that is to set a relative positioning context so we can absolutely position panels inside of it. All the panels will be of equal height and width and positioned exactly on top of each other. Both panels and tabs share the same 1px border.</p><pre><code class="css">.box-wrap { position: relative; min-height: 250px; }
.tabbed-area div div { background: white; padding: 20px; min-height: 250px; position: absolute; top: -1px; left: 0; width: 100%; }
.tabbed-area div div, .tabs li a { border: 1px solid #ccc; }</code></pre><p>Now the magical part that makes it work is as simple as adjusting the z-index of the panels when they are &#8220;targeted&#8221;.</p><pre><code class="css">#box-one:target, #box-two:target, #box-three:target {
  z-index: 1;
}</code></pre><h3>Ruh-Roh&#8230; What about current tab highlighting?</h3><p>What we have so far is a totally functional tabbed area. You click the tab, the corresponding content in that tab loads. Functional, but not the most helpful UI. There is no feedback at all which tab is the currently showing tab, either when the page loads or even when you click to view a different tab.</p><p>This is a fairly major hurdle. I find a way to solve it, and we&#8217;ll go through that here, <strong>but it&#8217;s dirty</strong>. The root of the issue is that we can&#8217;t select back &#8220;up&#8221; the element tree. So if we need the panels to have ID&#8217;s, the only thing we can affect in CSS is decedents of that div when it is in :target. For example:</p><pre><code class="css">#box-four:target a[href="#box-four"] { color: red; }</code></pre><p>That would be a cool way to select only that particular link when that panel is active, but as of now, we can&#8217;t do that because that link isn&#8217;t a descendant of the panel.</p><p>The only way I&#8217;ve been able to solve this is to actually just make the navigation descendants of the panels. This is a bummer, because that means that each panel needs to repeat the tabs&#8230;.</p><pre><code class="html">&lt;div class="box-wrap"&gt;

	&lt;div id="box-four"&gt;
        &lt;!-- content for panel --&gt;

        &lt;ul class="tabs group"&gt;
            &lt;li class="cur"&gt;&lt;a href="#box-four"&gt;Tab 4&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#box-five"&gt;Tab 5&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#box-six"&gt;Tab 6&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
	&lt;/div&gt;

	&lt;div id="box-five"&gt;
	    &lt;!-- content for panel --&gt;

        &lt;ul class="tabs group"&gt;
            &lt;li&gt;&lt;a href="#box-four"&gt;Tab 4&lt;/a&gt;&lt;/li&gt;
            &lt;li class="cur"&gt;&lt;a href="#box-five"&gt;Tab 5&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#box-six"&gt;Tab 6&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
	&lt;/div&gt;

	&lt;div id="box-six"&gt;
	    &lt;!-- content for panel --&gt;

        &lt;ul class="tabs group"&gt;
            &lt;li&gt;&lt;a href="#box-four"&gt;Tab 4&lt;/a&gt;&lt;/li&gt;
            &lt;li&gt;&lt;a href="#box-five"&gt;Tab 5&lt;/a&gt;&lt;/li&gt;
            &lt;li class="cur"&gt;&lt;a href="#box-six"&gt;Tab 6&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
	&lt;/div&gt;

&lt;/div&gt;</code></pre><p>Very much not ideal, I know. But now that the lists are inside the panels, we can just use a &#8220;current&#8221; class on the list item that is the correct corresponding link and style that. And we&#8217;ll make sure the current panels tab navigation is positioned above the panels and is &#8220;on top&#8221; when it&#8217;s panel is.</p><pre><code class="css">.cur-nav-fix .tabs { position: absolute; bottom: 100%; left: -1px; }
.cur-nav-fix .tabs li a { background: -moz-linear-gradient(top, white, #eee); }
#box-four { z-index: 1; }
#box-four:target .tabs, #box-five:target .tabs, #box-six:target .tabs { z-index: 3; }
.cur-nav-fix .tabs li.cur a { border-bottom: 1px solid white; background: white; }</code></pre><div class="image-wrap"> <img src="http://css-tricks.com/wp-content/csstricks-uploads/curnavtab.png" width="320" height="148" alt="" title="" /><br /> Now with current tab highlighting!</div><div style="background: #faf2c5; border: 1px solid #ccc; padding: 20px;"><h4 style="color: red;">Update</h4><p>The above code, as mentioned, is definitely not a good way to go. I played with this whole idea a bunch more and the demo linked to now below has a whole bunch of different ideas for this including some decent solutions.</p></div><h3>Demo and Download</h3><p>Use at will, just be aware of the IE 7 problem. All of the HTML and CSS are right on one page, so if you want to &#8220;download&#8221; it, just copy and paste the code into an html file and save it.</p><p><a href="http://css-tricks.com/examples/CSSTabs/" class="button">View Demo</a></p><h3>Hash it out</h3><p>You&#8217;ll notice in the demo that if you click a tab in the one on the left and then click on a tab in the one on the right, the area on the left will revert back to it&#8217;s default slide rather than keep it&#8217;s current slide. That all goes back to :target and how it&#8217;s related to the hash in the URL. There is really no way around this without bringing in JavaScript, so if that&#8217;s not gonna work for you, you should probably just go JavaScript from the get-go.</p><p>Also, hash tag links &#8220;jump down the page&#8221; when clicked, so also note that that when you click a tab your browser window will pop down to have that tab be the top-most element (if there is enough room to scroll down on the page). Again, no fighting that without JavaScript to my knowledge.</p><h3>Other resources</h3><ul><li><a href="http://carsonified.com/blog/dev/stay-on-target/">Stay on Target</a> &#8211; Awesome article from Think Vitamin, unfortunately missing it&#8217;s demos. It covers some uber clever techniques though.</li><li><a href="http://www.w3.org/TR/css3-selectors/#target-pseudo">W3C spec on :target</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://css-tricks.com/css3-tabs/feed/</wfw:commentRss> <slash:comments>45</slash:comments> </item> <item><title>Unicode Characters for Class Names</title><link>http://css-tricks.com/unicode-class-names/</link> <comments>http://css-tricks.com/unicode-class-names/#comments</comments> <pubDate>Fri, 05 Mar 2010 13:15:48 +0000</pubDate> <dc:creator>Chris Coyier</dc:creator> <category><![CDATA[Article]]></category><guid isPermaLink="false">http://css-tricks.com/?p=5728</guid> <description><![CDATA[Reader Kartlos emailed me in pointing to me to an interesting article by the great Mr. Snook from a few years back. I don&#8217;t think I had seen it before and it&#8217;s a bonafide &#8220;CSS Trick&#8221; so I thought I would share. The idea is that you can use unicode characters (read: fancy symbols) for [...]]]></description> <content:encoded><![CDATA[<p>Reader Kartlos emailed me in pointing to me to an interesting article by the great <a href="http://snook.ca/archives/html_and_css/unicode_for_css_class_names">Mr. Snook</a> from a few years back. I don&#8217;t think I had seen it before and it&#8217;s a bonafide &#8220;CSS Trick&#8221; so I thought I would share.</p><p>The idea is that you can use unicode characters (read: fancy symbols) for class names in your HTML, and even use write CSS selectors with those same characters.</p><pre><code class="html">&lt;div class="♫"&gt;
    A.A. Bondy
    &lt;em&gt;I Can See The Pines Are Dancing&lt;/em&gt;
&lt;/div&gt;</code></pre><pre><code class="css">.♫ {
   display: block;
   background: #eee;
   padding: 5px;
 }</code></pre><p>Pretty cool eh? I&#8217;d call my example above perfectly semantic as well, since the div with the music note class name is marking up a musician and song. Possibly even more semantic, as a music note symbolizes music moreso than any English word.</p><p><span id="more-5728"></span></p><p>I put together a <a href=" http://css-tricks.com/examples/UnicodeClassNames/">super simple demo page</a> that shows it working. Oh, and yes-it-works-in-IE6&trade; &amp; yes-it-validates&trade;</p><h3>But&#8230;</h3><p>One funny thing? View the source on that page. I use PHP includes for the headers and footers of all my demos, and because of the character encoding (?) of that page the PHP doesn&#8217;t run it just sits there as text.</p><div class="image-wrap"> <img src="http://css-tricks.com/wp-content/csstricks-uploads/phpastext.png" width="326" height="87" alt="" title="" /><br /> That ain&#8217;t right.</div><div class="image-wrap"> <img src="http://css-tricks.com/wp-content/csstricks-uploads/codawarning.png" width="566" height="171" alt="" title="" /><br /> Coda does warn you first.</div><p>Weird eh? If you know how this could work both ways, let me know.</p><h3>Other uses</h3><p>Jonathan presented (in his original article) and idea for targeting the corners of a box.</p><pre><code class="html">&lt;div class="□"&gt;
  &lt;div class="┌"&gt;
    &lt;div class="┐"&gt;
      &lt;div class="└"&gt;
        &lt;div class="┘"&gt;
          content
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;</code></pre><p>Remember back a few years ago most of us were rocking rounded corners with nested divs and images like that! The corners symbols are clever, but I could see the <tt>&lt;div class="□"></tt> being used for like &#8220;container&#8221; or &#8220;box&#8221; style classes today, or, perhaps best of all, <a href="http://css-tricks.com/snippets/css/clear-fix/">the clearfix</a>.</p><p>I posted a little code clip of this over on <a href="http://forrst.com/">Forrst</a> (sorry I know most folks don&#8217;t have accounts there yet) and a guy named Aaron had a funny idea. Using upside down writing to be annoying! <tt>id='ɹǝpɐǝɥ', id='ɹǝddɐɹʍ', id='ɹǝʇooɟ'</tt></p> ]]></content:encoded> <wfw:commentRss>http://css-tricks.com/unicode-class-names/feed/</wfw:commentRss> <slash:comments>61</slash:comments> </item> <item><title>New Screencast: CSS Image Switcher</title><link>http://css-tricks.com/new-screencast/</link> <comments>http://css-tricks.com/new-screencast/#comments</comments> <pubDate>Thu, 04 Mar 2010 07:10:55 +0000</pubDate> <dc:creator>Chris Coyier</dc:creator> <category><![CDATA[Screencast]]></category><guid isPermaLink="false">http://css-tricks.com/?p=5380</guid> <description><![CDATA[Roll over a link, watch the image above change. That’s what we build in this screencast, only we don’t use any JavaScript to do it. The trick is some simple z-index switching on hover and a bit of absolute positioning.View Screencast ]]></description> <content:encoded><![CDATA[<blockquote><p>Roll over a link, watch the image above change. That’s what we build in this screencast, only we don’t use any JavaScript to do it. The trick is some simple z-index switching on hover and a bit of absolute positioning.</p></blockquote><p><a href="http://css-tricks.com/video-screencasts/82-css-image-switcher/"><img src="http://css-tricks.com/wp-content/csstricks-uploads/screencast-82-thumb.jpg" width="249" height="154" alt="" title="" /><br /> View Screencast</a></p> ]]></content:encoded> <wfw:commentRss>http://css-tricks.com/new-screencast/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Increment Inputs with the Mousewheel</title><link>http://css-tricks.com/mousewheel-inputs/</link> <comments>http://css-tricks.com/mousewheel-inputs/#comments</comments> <pubDate>Wed, 03 Mar 2010 13:01:48 +0000</pubDate> <dc:creator>Chris Coyier</dc:creator> <category><![CDATA[Article]]></category><guid isPermaLink="false">http://css-tricks.com/?p=5780</guid> <description><![CDATA[In the past we&#8217;ve covered adding +/- buttons to number-based inputs to help user interface (it&#8217;s easier than typing in some circumstances). Reader Hitesh N Chavda emailed me with the idea of doing it with the scroll of the mouse wheel instead.With the mouse cursor inside the input box, you can use the [...]]]></description> <content:encoded><![CDATA[<p>In the past we&#8217;ve covered <a href="http://css-tricks.com/number-increment-buttons/">adding +/- buttons</a> to number-based inputs to help user interface (it&#8217;s easier than typing in some circumstances). Reader Hitesh N Chavda emailed me with the idea of doing it with the scroll of the mouse wheel instead.</p><div class="image-wrap"> <img src="http://css-tricks.com/wp-content/csstricks-uploads/mousewheelinput.png" width="226" height="68" alt="" title="" /><br /> With the mouse cursor inside the input box, you can use the mouse scroll wheel to increment the number up and down.</div><p>Hitesh worked up a technique for doing it using jQuery, which works great. Then later he found <a href=" http://brandonaaron.net/code/mousewheel/demos">a plugin</a> which has already been built for dealing with mousewheel events, which is really nice and simplifies things. Just for fun the demo will leave both versions in it.</p><p><span id="more-5780"></span></p><h3>HTML</h3><p>This could literally work on any element, but text inputs make the most sense. Perhaps this could be used on a time-tracking form where you need to need to enter the number of hours/minutes spent on something. Or perhaps an order form for entering how many of something to order.</p><p>In our demo we&#8217;ll just have a label input pair like you&#8217;d find in just about any &lt;form>:</p><pre><code class="html">&lt;div&gt;
    &lt;label for="how-many"&gt;How Many? &lt;/label&gt;
    &lt;input type="text" id="how-many" class="wheelable" value="1" name="how-many" /&gt;
&lt;/div&gt;</code></pre><h3>jQuery</h3><p>If you want to check out the non-plugin version of this, just download the files below. We&#8217;ll cover using the plugin here, for brevity. You&#8217;ll need to include jQuery, the plugin, and your own JavaScript file:</p><pre><code class="html">&lt;script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="js/jquery.mousewheel.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="js/increment.js"&gt;&lt;/script&gt;</code></pre><p>When the DOM is ready, we&#8217;ll bind the new &#8220;mousewheel&#8221; event to the input. When that input fires, if it&#8217;s an &#8220;up&#8221; mousewheel scroll, we&#8217;ll increment the value upwards one, if &#8220;down&#8221;, it will be decremented by one (unless it&#8217;s already zero).</p><p>The appending of the image on the first line is so that non JavaScript users won&#8217;t see the graphic which indicates mousewheel scrollability.</p><pre><code class="javascript">$(function() {

    $("div").append('&lt;img src="images/mousewheelupdown.png" alt="Scroll up or down with mousewheel" /&gt;');

    $("#how-many").bind("mousewheel", function(event, delta) {
        if (delta &gt; 0) {
            this.value = parseInt(this.value) + 1;
        } else {
            if (parseInt(this.value) &gt; 0) {
                this.value = parseInt(this.value) - 1;
            }
        }
        return false;
     });

});</code></pre><h3>What about non-numeric inputs?</h3><p>You&#8217;ll have to deal with that as needed. Now that you have the &#8220;mousewheel&#8221; event that the plugin provides, the function you write when that event fires could be anything. In the demo I have a text input which cycles through a list of different kinds of whales&#8230;</p><pre><code class="javascript">$("#whale").bind("mousewheel", function(event, delta) {
    if (this.value == "Blue") {
        this.value = "Sperm";
    }
    else if (this.value == "Sperm") {
        this.value = "Orca";
    }
    else if (this.value == "Orca") {
        this.value = "Humpback";
    }
    else if (this.value == "Humpback") {
        this.value = "Blue";
    }
    return false;
 });</code></pre><div class="image-wrap"> <img src="http://css-tricks.com/wp-content/csstricks-uploads/whale.png" width="321" height="79" alt="" title="" /><br /> Killer whales are getting all the press lately, time for some Humpback love.</div><h3>Degradation</h3><p>This is pure progressive enhancement. Without JavaScript the inputs are still inputs which behave just as any other input would.</p><h3>Enjoy</h3><p><a class="button" href="http://css-tricks.com/examples/MousewheelInputs/">View Demo</a> &nbsp; <a class="button" href="http://css-tricks.com/examples/MousewheelInputs.zip">Download Files</a></p> ]]></content:encoded> <wfw:commentRss>http://css-tricks.com/mousewheel-inputs/feed/</wfw:commentRss> <slash:comments>32</slash:comments> </item> <item><title>Speed Up with CSS3 Gradients</title><link>http://css-tricks.com/css3-gradients/</link> <comments>http://css-tricks.com/css3-gradients/#comments</comments> <pubDate>Tue, 02 Mar 2010 13:43:41 +0000</pubDate> <dc:creator>Chris Coyier</dc:creator> <category><![CDATA[Article]]></category><guid isPermaLink="false">http://css-tricks.com/?p=5700</guid> <description><![CDATA[WebKit browsers paved the way with CSS based gradients. Now Firefox 3.6 is out and is supporting them as well, which makes using them for progressive enhancement all the more appealing. More good news, CSS3 gradients fall into the camp where you can specify fallbacks (i.e. images) so that browsers that don&#8217;t support them just [...]]]></description> <content:encoded><![CDATA[<p>WebKit browsers paved the way with CSS based gradients. Now Firefox 3.6 is out and is supporting them as well, which makes using them for progressive enhancement all the more appealing. More good news, CSS3 gradients fall into the camp where you can specify fallbacks (i.e. images) so that browsers that don&#8217;t support them just use the image instead.</p><p>But wait&#8230; if you need to use an image anyway, why bother with declaring the gradient with CSS?  That is kind of how I felt for a long time, but there is one important aspect that makes it worth it: <strong>browsers that support them don&#8217;t load the image fallback.</strong> One less HTTP Request = all the faster your site will load.</p><p><span id="more-5700"></span></p><p><strong>Huge thanks to <a href="http://www.spathon.se/">Patrik Spathon</a> for this idea and help with the demo page!</strong></p><h3>How it&#8217;s done</h3><p>Cutting to the chase, here is how it&#8217;s done:</p><pre><code class="css">div {
            background-color: #1a82f7; /* fallback color */
            background-image: url(images/linear_bg_2.png); /* fallback image */
            background-image: -moz-linear-gradient(100% 100% 90deg, #2F2727, #1a82f7);
            background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#1a82f7), to(#2F2727));
}</code></pre><p><a href="http://css-tricks.com/examples/CSS3Gradient/" class="button">View Demo</a> &nbsp; <a href="http://css-tricks.com/examples/CSS3Gradient.zip" class="button">Download Files</a></p><h3>Different syntax for different rendering engines</h3><h4>Mozilla (Firefox, Flock, etc)</h4><p>Mozilla&#8217;s syntax (<a href="https://developer.mozilla.org/en/CSS/-moz-linear-gradient">more detail here</a>) is like this:</p><pre><code class="css">-moz-linear-gradient( [&lt;point&gt; || &lt;angle&gt;,]? &lt;stop&gt;, &lt;stop&gt; [, &lt;stop&gt;]* )</code></pre><p>The simplest way to declare a gradient is to just list a comma separated list of colors. That will start at the top and gradient to the bottom with equidistant color stops for each color. In the demo code above, we use a point and an angle (90deg) to it go bottom-to-top instead. For radial gradients: <tt>-moz-radial-gradient</tt></p><h4>WebKit (Safari, Chrome, etc)</h4><p>WebKit&#8217;s syntax (<a href="http://webkit.org/blog/175/introducing-css-gradients/">more detail here</a>) is like this:</p><pre><code class="css">-webkit-gradient(&lt;type&gt;, &lt;point&gt; [, &lt;radius&gt;]?, &lt;point&gt; [, &lt;radius&gt;]? [, &lt;stop&gt;]*)</code></pre><h4>Trident (IE)</h4><p>Trident&#8217;s syntax (not really CSS3&#8230; <a href="http://msdn.microsoft.com/en-us/library/ms532997%28VS.85,loband%29.aspx">more detail here</a>) is like this:</p><pre><code class="css">filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr=#1471da, endColorstr=#1C85FB);

-ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#1471da, endColorstr=#1C85FB)";</code></pre><p><strong>Unfortunately, we can&#8217;t invite IE to the party!</strong> Using these filter properties does indeed work, and it would allow us to programatically declare gradients which is cool. But, instead of using the filter first and the image as a fallback, declaring a background-image overrides the filter and it uses that. Since we definitely still need image fallbacks, we might as well not use this at all.</p><h3>&#8220;Stops&#8221;</h3><p>The WebKit and Mozilla syntax for gradients both incorporate &#8220;stops&#8221;. A stop is an optional additional declaration that includes a point and a color. This means the gradient wont just start at one color and end at the other, it will fade to the stop color first, and that stop color will fade to the end color. More than one stop can also be used.</p><p><img src="http://css-tricks.com/wp-content/csstricks-uploads/stopexample.jpg" width="570" height="200" alt="" title="" /></p><h3>Saving HTTP requests</h3><p>Using Firebug and looking in the Net tab to see all the resources used by the page, we can see the advantage.</p><div class="image-wrap"> <img src="http://css-tricks.com/wp-content/csstricks-uploads/gradientnotloaded.jpg" width="449" height="347" alt="" title="" /><br /> The above screenshot is Firefox 3.6. We can see that the gradient fallback images are NOT loaded, which saves an HTTP request.</div><p>However using Firefox 3.5.8, the fallbacks <strong>are</strong> loaded.</p><div class="image-wrap"> <img src="http://css-tricks.com/wp-content/csstricks-uploads/gradientisloaded.jpg" width="427" height="400" alt="" title="" /><br /> We don&#8217;t save any HTTP Requests in olders version of Firefox (This is 3.5.8 on Vista). The gradient fallback images are still being loaded (and used).</div><p>It gets a little more iffy in WebKit browsers.</p><div class="image-wrap"> <img src="http://css-tricks.com/wp-content/csstricks-uploads/safariloadsgradient.jpg" width="493" height="381" alt="" title="" /><br /> WebKit browsers WILL use the CSS3 property to render the gradient, but at the same time, still load the fallback images, so no HTTP requests are saved. The only advantage is the programatic declaration of color.</div><h3>Doing it by the numbers</h3><p>The speed gained by losing an HTTP request, to me, is the biggest advantage. The more I learn about web performance it seems to me keeping those down is the #1 way to improve page load time. However there is another advantage to using CSS3 gradients, and that is that these gradients are created programatically through numbers. Need to adjust some colors? Just adjust some numbers. No need to bring a big image editing program into the picture. This makes maintaining the site easier, as well as opens up doors for adjusting values on-the-fly. I imagine JavaScript libraries will begin to get the ability to animate these values soon enough, which will be pretty darn cool.</p><h3>Ooooh Stretchy</h3><p>When using an image for a gradient, it is declared as a CSS background-image and then repeated (you can often get away with a 1px slice, which is very efficient, size wise). The result though is that a static portion of the background is gradientized, and any overflow to that is flat color. Sometimes that works perfectly. Sometimes though it would be cool if the gradient stretched the entire height or width of the box. That is another thing CSS3 gradients can possibly be useful for:</p><p><img src="http://envisioncad.com/wp-content/images/stretchy.jpg" width="570" height="250" alt="" title="" /></p><h3>So the big question is&#8230;</h3><p><strong>Is it really worth doing right now?</strong> I&#8217;m thinking it&#8217;s pretty darn close. If the numeric representation is a big deal to you, then I say yes you should start using them. If the speed is the only reason you would, then just realize that the only browser that it will help in is Firefox 3.6+, so you might wanna wait a bit on that.</p><h3>Additional Resources</h3><ul><li>Robert Nyman: <a href="http://robertnyman.com/2010/02/15/css-gradients-for-all-web-browsers-without-using-images/">CSS gradients for all browsers</a></li><li><a href="http://gradients.glrzad.com/">CSS3 Gradient Generator v2.0</a></li><li><a href="http://westciv.com/tools/gradients/index.html">Linear Gradients</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://css-tricks.com/css3-gradients/feed/</wfw:commentRss> <slash:comments>55</slash:comments> </item> </channel> </rss><!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 10/24 queries in 0.014 seconds using apc
Content Delivery Network via cdn.css-tricks.com

Served from: css-tricks.com @ 2010-03-12 07:08:21 -->
