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

Article Archives

one comment

Links of Interest

An Optical Illusion with CSS and Parallax

Marco Kuiper has put together a really cool optical illusion using the CSS parallax technique I posted about a while back. Check out his post and example. Make sure to resize your browser window while you are there, that's how it works.


Timelapse CSS

Matthew Buchanan came up with a simple yet clever little snippet of javascript that would remove one CSS rule every tenth of a second. He applied this …


HTML 5 vs. XHTML 2: An Article Roundup and Poll

Much like CSS3, widespread adoption for the next-gen web languages is a distant mirage. Still, it is important to stay educated on these things and even participate in these early stages while things are still malleable. Rather than re-hash everything here, here is a roundup of articles talking about the two major new "competing" formats.

There is also a new poll in the sidebar where you can cast your vote as to which one you prefer at this point, or …


Twitter, New Screencast, 404

Tweet Tweet

I've been enjoying the Twitter thing more and more lately. Here is my Twitter page if anyone wants to follow. Just for fun, I've used some of that extra space down in my footer here on CSS-Tricks for a little "Twitter Updates" section. Fun fun! I took what I learned doing that and wrote up a tutorial for Tutorial Blog:

How To Make a Unique Website For Your Twitter Updates


New Screencast: Introduction to the Band Website…

My Big Ol’ List of Design/Development, HTML/CSS and Personal Blogs I Read

I've had a few folks ask recently what other sites I read. Like many of you I suspect, I'm a bit of a junkie when it comes to design & tech news. I really enjoy popping open Google Reader and having a nice amount of articles I can browse through. It's really amazing how much good stuff is out there on a daily basis. I do tend to avoid stuff like Slashdot, Engadget and Boing Boing. They often have great …


How To: Resizeable Background Image

If you are looking for how to do FULL SCREEN BACKGROUND IMAGE, go here.

My friend Richard recently came to me with a simple CSS question:

Is there a way to make a background image resizeable? As in, fill the background of a web page edge-to-edge with an image, no matter the size of the browser window. Also, have it resize larger or smaller as the browser window changes. Also, make sure it retains its ratio (doesn't …


Links of Interest

Line Height Abnormal

Eric Meyer digs into some of the peculiarities of line-height:

Here’s the punchline: the effects of declaring line-height: normal not only vary from browser to browser, which I had expected—in fact, quantifying those differences was the whole point—but they also vary from one font face to another, and can also vary within a given face.


Setting a Body ID (with PHP)

I've mentioned the powers of giving your body tags an ID about a million times …


Redirecting to a Splash Page ( …but only once! ) with Cookies

Splash pages can be annoying. You know the ones... like being forced to watch some advertisement before you can see the page you are trying to get to. Or maybe some fancy introduction to a site that you are automatically redirected to every time you visit. Great.

There are some circumstances where a splash page can be useful. Say you are running a band website and they release a new album. You may want to redirect people visiting to a …


Sponsored Feature: Flipping Book

Flash can do some amazing stuff. Stuff that can leave even the handiest CSS and Javascript developer drooling with envy. We then sulk back to our caves because, alas, Flash is not the development path we have chosen. This is a foreign world who's amazing feats are out-of-grasp lest we start learning a whole new development environment from scratch.

One of those drool-inducing Flash feats is Flipping Book. This is an amazing Flash object which mimics the behavior of …


Poll Results: What Javascript Library Do You Use?

...and the jQ's have it! At the time of this writing over 1500 people have responded to our latest poll "What Javascript Library Do You Use?" making it our biggest poll yet. jQuery is the run-away victor with over 50% of the votes. What does this mean? Just that the beautiful and intelligent readers of CSS-Tricks have a tendency to lean toward jQuery. However, since this site is largely design focused and there was the whole other 50% of votes …


Launch: Band Website Template

Sorry folks, The Band Website Template has been discontinued. It was as great run, but we've decided to move on to other projects and clear up the time we spent maintaining and supporting this one.

I've been working on this joint project for quite a while now, and it's finally ready. Introducing the Band Website Template! Brought to you by yours truly and David Walsh.

What is the Band Website Template?

The Band Website Template is a downloadable package …


Toolbox CSS

Over on Tutorial Blog, I shared my "Toolbox CSS" that I like to use:

What is Toolbox CSS?

Toolbox CSS is styling information that has nothing uniquely to do with any particular website. These are a collection of common styles that can be useful on any web project. How many times have you written a class for clearing a float? Too many, is my guess. The idea with Toolbox CSS is to include a separate stylesheet for these "utility" styles.…


Links of Interest

CSS Qualified Selectors

Shaun Inman has an idea for a submission to the CSS3 Working Group he is calling CSS Qualified Selectors. Definitely read the article to get the full low-down, but I'll summarize: this is a way to add styling to a parent element based on its children. For example, if you have a list item that contains a visited link, right now you are only able to target the visited link with CSS such as "ul …


How To Fix Video Slowing Down Your Page Load Time

I have a client who demanded an auto playing video on their homepage. Normally our job as designers is to translate our brain's first thoughts:

"OMG. WTF? Are you trying to drive people away never to return?"

Into something more like:

"I'm not sure that is the best idea right now. Some people find autoplaying video on websites annoying and our goal is to keep people on the site so they can discover more about you."

But sometimes it comes


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

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, I like to ask you to inspire me on this issue. We need a …


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 …