Treehouse: Grow your CSS skills. Land your dream job.

Article Archives


From The Forums: Fluid, Fluid, Fixed & More

The CSS-Tricks Forums have been going very well since launch. It has only been just over a month and we have 130+ members and 660+ posts. Lots of great discussions have popped up and lots of folks have gotten the troubleshooting help they needed. Huge thanks to everyone! I thought I would highlight a couple of the threads:…


Weather Switcher Updated

I wanted to post a quick note to let folks know that the Weather Switcher that me and David Walsh whipped up a while ago has been updated to actually work again. Yahoo made a slight change to how they were serving up that weather data (grumble...)

Several people have had problems with this lately, and I'm sure this is why. Enjoy!…


Better Pull Quotes: Don’t Repeat Markup

Pull quotes are wonderful. They can really draw a readers attention and they are a great opportunity for cool typographic work. On a blog though, pull quotes are particularly difficult to "pull off" (get it?!).
This is because of RSS. On your own site, you can create a pullquote using any kind of markup you want. Perhaps a paragarph tag with a class of "pullquote". But when that goes out to RSS readers, that tag will either be stripped or …


Sponsored Feature: Web Resources Depot

I'm a junkie for web resources websites. I love browsing through them because I am always bound to find some example of something that sends my mind off on some tangent thinking about the possibilities. How can I extend it or modify it? What other applications can I find for it? Do I have any clients who it would work for?…


Can We Prevent CSS Caching?

When you are developing a site, there is a heck of a lot of "refreshing" going on. You start to get a pretty good feel for what your browser is going to pick up on a single refresh, and what it won't. For example, I find that if I over-write an image file on the server, it will take me two refreshes for that image to update on the live site. Then maybe I'll pop over into Opera and see …


IE CSS Bugs That’ll Get You Every Time

IE 6 actually had the best CSS support of any browser when it first came out... SEVEN YEARS AGO. The little bugs in it's CSS support still haunt us to this day. I still get comments from people who roundly reject any technique that doesn't work in IE 6. While I generally refuse to pander to IE 6's limitations, I still feel it is important to make things look right in it whenever possible. Here are that major bugs in …


Links of Interest

NETTUTS Launches

If NETTUTS lives up to the quality standard of PSDTUTS, this is going to be a great resource for web design and development tutorials!…


Improved Current Field Highlighting in Forms


As a matter of usability and aesthetics, it is a good thing to add some kind of visual feedback on web forms to indicate the currently active (or "focused") field. Some browsers (Safari/Opera) have decided that is so important, that it take matters into it's own hands and applies a glowy blue border around active form elements:…

one comment

Talent Hunters and Job Seekers: Authentic Jobs

Authentic Jobs is widely regarded as the premier job board for web designers and developers. It is run by Cameron Moll who himself is an incredible designer. You can help support CSS-Tricks, and help yourself by finding talented people to work for you, by using Authentic Jobs.


Fine Use for the Adjacent Sibling (“+”) Selector

My friend Richard came to me with an interesting problem yesterday. He was using some API of some kind that was returning to him a big list of companies. Each company had text, and most (but not all) also had an image. He wanted to use the image if they had one, but if he was showing the image he didn't want to show the text also. The solution had to be to output both the image and …


New Poll: What is your Javascript library of choice?

I know I've been talking a lot about jQuery lately, but I promise I won't stray too far off the CSS path. I would like to find out what everyone else's favorite Javascript libraries, hence the new poll, "What is your javascript library of choice?".

I know for a fact we have some serious advocates for jQuery, MooTools, and Adobe Spry around here, which is awesome we have that diversity. But it will be interesting to see how popular the …


Now With Archives!

There were pretty much no archives to speak of on CSS-Tricks before. You could browse by month and year (and I'll probably leave that alone for now), but that was a really crappy way to peruse the archives. Thanks to a fancy little plugin I stumbled across, there is now an official CSS-Trick Archives page.

In other meta-news, I completed the upgrade to WP 2.5, which was almost entirely painless (thank god). …


Some Updated and Improved Examples

We are all learning and becoming better web designers and developers all the time. At least I hope we are, that is the whole point of this site! It is always a good idea to re-visit things from time to time and make sure we did things as well and as smart as we are able. If it's been long, chances are there are things that can be done better. Here are some examples that I have updated recently.


Links of Interest

Clearing absolutely positioned elements fixes IE bug

The actual title of the article is "CSS - An Absolute Mess", but I retitled it here to something less linkbaity and more accurate. Nonetheless, a valid fix for something IE normally borks.


Who Should Redesign?

Another one of these design-related hot-or-not style sites where you vote on if a site should redesign or not. Yes, yes, yes, yes, yes, yes....


Accordian to who?

Couple of great accordian …


Fade-in Spoiler Revealer

jQuery has some really simple built in features for "fading in" and "fading out" different page elements. I thought we could exploit some of those functions for a really simple Spoiler Revealer.

View DemoDownload Files

Between some smart CSS and jQuery, we can keep our markup really clean. Take a look at the usage here:

<p>In the movie Citizen Kane, Charles Foster Kane's last word "Rosebud" turns out to <span class="spoiler">be a sled.</span></p>

That's right, just …


Indent CSS Changes You Are Unsure About

Sometimes the simplest little things can save you major headaches later. The kind of headache I am talking about here is when you make a change to a CSS file only to find out days later that it broke something on a part of your website you didn't notice at the time. It could be very obvious. You remember exactly what you did and can jump back in there and fix it. But what if you made a lot of …


Learning jQuery: Fading Menu – Replacing Content

Update January 2013: Best practice for this kind of this is detailed here. Update May 2010: I'm considering this article deprecated. I have an updated article here, which covers this same type of material only with more features, updated technology, and better practices.

The more I learn about jQuery, the more natural it feels. Probably because of how closely tied to CSS it is. From a design perspective, the syntax for jQuery is:

"When I do this


Links of Interest

The Amazing Color Label Wheel

Holy relative percentage positioning! This was built from asking people how they would describe thousands of colors.


CSS News

One of those headline aggregator style sites (like POPurls) only for just CSS stuff. Hey, CSS-Tricks is on there! Cool.


CSS Frame Generator

Paste your markup into the box and click the button. This site will look at every tag on the page and generate an empty CSS file for you that specifically …

one comment

Poll Results: Is CSS Coding Part of Your Career?

At the time of this writing, the poll is showing that the largest percentage of you (34%) have careers in which CSS plays a huge part (75%-100% of it). I definitely fit into that category myself.

I really wasn't sure what to except with this one, so I'm not surprised that there is a pretty even split between the mid-range percentages. I am quite surprised at the top and bottom levels though! For sure, I would have though the 0% …


CSS Off Entry

I mentioned CSS Off earlier in the week, but I wasn't sure if I was going to have time this weekend to participate. As fate would have it, I happened to be browsing my feeds late Friday night and saw the post pop up that the files were ready. I figured I'd at least download the PSD and check it out. Of course as soon as I start poking around in the file, I was hooked. I started slicing stuff …


Designing the Digg Header: How To & Download

The design of Digg is full of smart ideas. The site identity is strong but doesn't take up too much valuable vertical space. Navigation is compacted with the use of simple drop-down menus. Important things like subscribing, searching and account information are right up top where you would expect them to be. It's fluid width, but it doesn't shrink too far or grow too big.

Let's design the Digg header!



1. The Page…

Multiple Backgrounds: Left Half and Right Half

Hey! This article is pretty old. We revised it here which includes much better information.

The introduction of the brand-new CSS-Tricks forums the last few days has been great! It was worried it would take a while for it to catch on, but the last few days there have been about 150 posts in lots of great topics.

One of those great topics was John Steven's background challenge:

I'm standing before a challenge and because to celebrate this new forum, …


Links of Interest

Just how many classes can you apply to a single element?

Kilian Valkhof finds out with some javascript. Opera and Safari, 4000ish. FF and IE7, 2000ish. So the answer:

Way more than we’ll ever need.


Web Design Rap

This is so great. There is actually a lot of good information packed inside all this awesomeness.

Please don't use tables even tho' they work fine. When it comes to indexing they give search engines a hard time.

Word. …


Forums, Downloads & Header – Oh My!

I rolled out a slightly different new header for the site last night, and with it came some new navigational tabs. Here is a little overview of what's going on:


There are forums now! They are brand-spankin' new, so they are a bit of a ghost town right now. But that's to be expected. What I hope is that folks will post their troubleshooting questions in there, and do my best to help out and answer those questions in …


Learning jQuery: Revealing Photo Slider

So in my journey to to learn jQuery, I'm trying to learn to do some things that CSS can already do but that jQuery can do "sexier". Jonathan Snook has an article up "Content Overlay with CSS" in which extra content is revealed in a certain area when it is moused over. This inspired me to try to do something similar with jQuery. My first thought was a thumbnail photo gallery, where clicking a button would reveal the …


Learning jQuery: A Roundup Roundup

I've been really getting into this jQuery phenomenon lately. jQuery is tightly tied to CSS, so if you are already comfortable with CSS and are looking for ways to expand your possibilities, jQuery is the place to be. You can achieve so many cool effects with it, and there are so many good learning resources out there for it I think it makes sense for serious web designers to start getting their hands dirty with this. In the past few …


Javascript Page Slider Roundup

"Page Sliders" are a bit like Tabbed Boxes, only the content appears to slide by instead of be instantly replaced. This is a pretty nice effect and like tabbed boxes, it can help you get a lot of content onto a single page without risking visual clutter. There are a number of techniques and frameworks for creating these page sliders. Here is a round up of some ones that I have found and used.

Coda Slider

Niall Doherty's Coda


Links of Interest

960 Grid System

Nathan Smith has launched a CSS framework called the 960 Grid System. The theory is that 960 pixels is a great number for a fixed width site, because it fits nicely onto a 1024px screen and is evenly divisible by 2, 3, 4, 5, 6, 8, 10, 12, 15, 16, 20, 24, 30, 32, 40, 48, 60, 64, 80, 96, 120, 160, 192, 240, 320 and 480. This makes it ideal for splitting into columns for …


Group Interview

I recently participated in a group interview about clients, design, and freelancing in general over on Vandelay Website Design.


The rest of the participants were:
Alen Grakalic of CSS Globe
John Phillips of Freelance Folder
David Airey
Matt Griffin of Liquid Design Media
Connor Wilson
Thord Daniel Hedengren
Michael Martin of Pro Blog Design
Jacob Cass of Just Creative Design
Dejan Cancarevic of StylizedWeb

These interviews are kind of fun. I also did one on Snap2Objects recently. …


Nine Techniques for CSS Image Replacement

CSS image replacement is a technique of replacing a text element (usually a header tag) with an image. An example of this would be including a logo on a page. You may want to use a <h1> tag and text for this for the accessibility and SEO benefits, but ideally you'd like to show your logo, not text.

Update (March 14, 2012). I've created a new page that now covers more image replacement techniques, including the more recent Scott

Using CSS for Image Borders

The following is a Guest Post written by Volkan Görgülü. Thanks Volkan!

The picture used in this article, The Solitude of the Fisherman, is from Daniel Cheong. I have come across with this picture in an article at Smashing Magazine.

Generally when we put borders around our images, as you can see in the example below, they make the image look more appealing. They make the image stand out from the other content on the page.…


Site News

Registration Now Available

For those of you who like to leave comments here on CSS-Tricks (Thanks, by the way!), I wanted to make it easier for you. You can now register for an account. Then when you are logged in, you don't have to fill out that Name / Email / Website thing every single time you want to comment.

There may be benefits for registering sometime in the future, like potentially some exclusive content or exclusive screencast or …


Links of Interest


This is another one of those automatic menu builder sites. I think this one is pretty nice though. Lots of customizable features, you can save your menus there, you can download them and they come nicely packaged up with all the files you need.


New TutorialBlog Writer

TutorialBlog has been sold and bought and the new owners have hired me to be the new writer. Nothing will change here at CSS-Tricks, but I'll be writing about a wider …


New Poll: Is CSS Part of Your Career?

I am interested to know how many of you CSS-Tricks readers actually write CSS as part of their job or career.

  • 0% - You don't do anything CSS related at work
  • 1-25% - You use CSS a little bit but it's not a main focus
  • 25-50% - CSS is a part of my job, but I do a lot of other stuff too
  • 50-75% - Much of what I do is CSS based web design, but not all
  • 75% -

How To: Create a Tabbed Box with YUI Tabs

Tabbed boxes are all the rage these days. Check out the "Explore" section on MSNBC, or the Premium News Theme to see how they can be used in a blog setting. I think it's for a good reason. It allows you to add more content to a page with less clutter while engaging visitors to interact with the site. Plus it's just kinda fun.

Note how these "tabbed boxes" work. They instantly change the content inside the box when …


Rethinking CSS Image Replacement

When I say CSS image replacement, I mean taking a page element that isn't normally an image and turning it into an image. This is a very common trick and popular because of it's semantic meaningfulness and SEO benefits. A common place to use this is with a header tag.

The OLD Way <h1 class="main-logo"> CSS-Tricks </h1> h1.main-logo { width: 350px; height: 75px; background: url(images/header-image.jpg); text-indent: -9999px; }

If you turn CSS off, this will just …


Starry Night: Incredible 3D Background Effect with Parallax

If you haven't seen the mysteriously cool Silverback app teaser page you should check it out. The Gorilla was designed by Jon Hicks (yep! the same site with the cool body-border technique). Make sure you resize your browser around when you visit the site to see the cool "parallax" effect of the hanging vines. The site itself was designed by Paul Annett. Paul wrote an article on Think Vitamin on how he created that parallax effect.…


Links of Interest

Challenge: CSS Globe vs. CSS-Tricks

Someone started an XHTML Challenge between CSS-Tricks and CSS Globe. At the time it was started I was working on that new subscribe section and there was a screwed up tag causing the site not to validate (as you can see by my cries in the comments). I see they have updated the stats now though and it shows me validating. It's all in good fun, so head on over and vote. I also …


Quick Reminder About File Paths

Whenever I have a problem with an image "not showing up" on a web page, the first thing I do is take a close look at the file path that references that image. If that file path is relative (meaning that it doesn't start with http://), I pay extra close attention to the relationship of where the file is that is referencing the image, and where that image actually is.

  • Is the image in the same directory as the file

Trying OpenID… and My Other WordPress Plugins

I get the question from time to time what plugins I use on this blog. Since I just got through installing a brand new one (Open ID), I thought this might be a good time to run through the list.


RSS / Feed Related

FeedBurner Feed Smith
I "burn" my feed through FeedBurner for the purpose of gathering statistics. These statistics wouldn't be very useful if only a portion of the subscribers used the FeedBurner feed. This plugin "forces" …


Poll Results: What CSS Reset Do You Use?

As of late yesterday here are the results:

I wasn't surprised to see the Meyer's reset in the lead. It is very popular, thoughtful, and effective. I was surprised to "What's a CSS Reset?" at a narrow second place. In a nutshell, a CSS reset removes default styling from page elements so that you are "starting fresh" with the attributes you choose to apply. This is important for two reasons. One, puts all browsers on a level playing field. Different …


The Different Techniques for Applying the PNG Hack

Alpha-transparent PNG's, ("PNG-24" for those of you saving out of Photoshop) are an amazing thing for web designers. We can make a button with a drop shadow on it and it will multiply that shadow onto whatever happens to be underneath it, even if that background changes. This may seem like a trivial thing, but it's really not. The possibilities that alpha transparency opens up for you as a designer are many. The problem, as you are likely well aware, …


Links of Interest

Photoshop Cryptoquote Challenge

This has nothing to do with CSS, but I thought it might be a fun little for any Photoshop gurus out there. Someone spraypainted a message on the side of one of my neighbor's houses. Before I could read what it said, the message was painted over. But you can still sorta read it, so I thought I'd snap a picture and see if I could Photoshop it and make out the message. I think I might …


CSS-Tricks Finally Gets A Print Stylesheet

This is way past due...but it's finally here: a print stylesheet!

I'll start by showing you the entire stylesheet, then I'll explain a little bit about what I was thinking.

body { font-family: Georgia, serif; background: none; color: black; } #page { width: 100%; margin: 0; padding: 0; background: none; } #header, #menu-bar, #sidebar, h2#postcomment, form#commentform, #footer { display: none; } .entry a:after { content: " [" attr(href) "] "; } #printed-article { border: 1px solid #666; padding: 10px; }

Equidistant Objects with CSS

Creating a horizontal row of objects that are equidistant from each other is another one of those things in web design that is much more difficult than it should be. This can be a very useful thing to do, especially in fluid width layouts when you are trying to make the most of whatever horizontal space you have.

Here are the goals we are trying to achieve:

  • The left-most object is left aligned with it's parent element.
  • The right-most object

Color Rendering Difference: Firefox vs. Safari

CSS-Tricks reader Norm writes in to ask me about a problem he is having with color on a new site he is designing:

I have a graphical question about my test site. The header and main page background are pulled from the same original graphic and in Firefox the header and body match up fairly well (I still need to do a little work to get the patterns to match up better) but in Safari the shade of brown …


Links of Interest

CSS Rand

I was kind of confused when I first went to CSS Rand, because it just looked like some random nice website (not a gallery) then I figured it out... It's a new kind of design gallery, where you just reload your page and it loads up a new page for you to look at. Kind of a neat idea. Lots of non-English sites too if you are into/not-into that. I'd like to see some kind of voting...…


CSS-Tricks Screencasts now on iTunes

It took a little while, but the CSS-Tricks Video Screencasts are now listed properly in the iTunes podcast directory.

Even cooler, you can just straight up search for "CSS" in the iTunes search area and it comes up as one of the ones right in the Podcasts section. Right next to "Let's Make Love and Listen to Death from Above". Perfect.

Here is the direct link:
CSS-Tricks Screencasts (iTunes Link)