Grow your CSS skills. Land your dream job.

Article Archives

Method & Craft

New must-subscribe-to site. Under the hood: curiously not HTML5. Almost feels rare these days. …

March 7, 2011

Open Source Ampersands

Little download packages by Mark Pilgrim that contain @font-face files that are super tiny because they contain just a single character: the ampersand. They come with an HTML demo so using them is an easy copy-and-paste job.…

March 7, 2011

It’s The Final Countdown

Microsoft themselves is tracking and promoting the demise of IE 6. China? 34.5%? Seriously?

And I can't help but hum a little Europe:

We're leaving together
But still it's farewell
And maybe we'll come back
To earth, who can tell?…

March 4, 2011

More Generated Content Tricks

Trevor Davis from Viget Labs with some clever and real-world implementations of pseudo elements.

There is so much to talk about with these pseudo elements it's crazy. I'm speaking at a few conferences coming up and I'm putting together a …

March 3, 2011

Quick Thoughts on Sharing Buttons

Randomly this week, I've had more-than-normal number of comments from folks who ask me something like:

Went to go tweet/share a blog post of yours, and noticed you don't have any of those on your site. Interesting, any reason why?…

March 3, 2011102 comments

Show and Edit Style Element

Kind of a classic little trick for ya'll today. You know the <style> blocks you can put in the <head> of your HTML to do styling? You don't actually have to put those in your head, they can be anywhere …

March 2, 201157 comments

Sans-Serif

Declaring just 'sans-serif' as the font-family means you'll get Helvetica on Mac, Arial on PC, and still have the good generic keyword fallback.
February 28, 201154 comments

Generated Background Noise

jQuery plugin by Daniel Rapp to fill any element with background noise. Uses <canvas> to create, then turns it into an image and sets a repeating background-image. Even if you'd be against using this on a production site, it's …

February 27, 2011

Stacking Order of Multiple Backgrounds

Multiple background images is a cool feature of CSS3. The syntax is easy, you just comma separate them. I find it's easiest/best to use the background shorthand property so you can declare the position and repeating and whatnot and keep …

February 25, 201134 comments

CSS3 Progress Bars

Just a fun experiment creating progress bars made with just CSS3 (no images). Loads of progressive nerdery packed into one little element.
February 24, 201147 comments

Bokeh with CSS3 Gradients

Bokuh is the effect of backgrounds in photographs with deep depth of field. Shapes round out and get blurry. Think of a really out of focus picture of a lighted Christmas tree. Divya Manian creates that effect in WebKit by …

February 24, 2011

I found it!

Funny article from Thierry Koblentz on CSS selector efficiency. Although there are cases where multiple ID selectors are needed, a selector like #nav li ul li a#active is almost certainly too heavy and inefficient. …

February 21, 2011

Letter Flipper

Randomly, I made a letter flipper thingy the other day. I saw a similiarish effect on a Flash site and tried doing it with JavaScript instead. You can view source on that page to see the simple code. It's just …

February 20, 201126 comments

Poll Results: HTML5 Features in Use on Production Sites

As a follow up to asking people if they are using HTML5 or not, I asked the people who are:

What features of HTML5 have you used on production sites?

These are the levels of popularity, from almost 3,000 …

February 17, 201131 comments

How Should We Calibrate Monitors for the Web?

When designing for print, having a properly calibrated monitor makes all the sense in the world. If done perfectly, what you see on the monitor should look like what you get on paper from a printer. No surprises.

When designing …

February 15, 201176 comments

Fade Image Into Another (within a Sprite)

Creating an image rollover is pretty easy with CSS. Give the element a background-image, then on it's :hover, change the background-image. It's best practice to combine both images into one and shift the background-position rather than use two …

February 14, 201144 comments

The Bright (Near) Future of CSS

Just in case anyone doesn't read Smashing Magazine, Eric Meyer has a long excerpt from his latest CSS book here which is loaded with good stuff. I particularly liked the bit about clearing :nth-child elements combined with media queries.…

February 11, 2011

CSS3 Loading Spinner

A WebKit-only demo of a loading animation. Loading text slowly reveals itself over and over while a spinner rotates around in a circle over and over infinitely.
February 10, 201129 comments

Rein In Fluid Width By Limiting HTML Width

You can set a max-width on the html element which helps keep fluid width sites under control with zero extra markup. Plus it's got pretty good browser support with a No Big Deal™ fallback.
February 9, 201122 comments

The Shapes of CSS

I made a page with the shapes you can make with a single HTML element and CSS. Here is an example:

View Demo   Download Files

The CSS you see on the page is the real CSS rendering that shape, …

February 8, 201160 comments

WebKit Adjacent/General Sibling & Pseudo Class Bug

Good news everyone! This is fixed in both stable releases of the WebKit browser Safari (5.1) and Chrome (13)

It's not every day you come across a solid bug in WebKit, which it seems to me leads the pack in …

February 4, 201117 comments

The New Bulletproof @Font-Face Syntax

I bet a lot of you are using @font-face in your designs. It's probably worth updating to this new syntax, which deals with IE9 and Android better than previous popular methods.…

February 3, 2011

Different Transitions for Hover On / Hover Off

In other words, "Different transitions on mouseenter and mouseleave" as those are the DOM events that happen, but we're not using JavaScript here, we're talking about CSS :hover state and CSS3 transitions. Hover on, some CSS property animates itself …

February 3, 201135 comments

Lessons with Media Queries

Sam Collins with a big writeup on his experience using media queries and comparing them against other mobile optimization techniques. There are lots of good practical tips to use inside your media queries like:

  • Remove all CSS and JavaScript animations
February 1, 2011

Implied Block

Jeff Starr tweeted a simple tip the other day:

If you're floating an inline element, it's treated as block, so no need to include "display: block;" in your stylesheet.

Indeed that is exactly what happens. The spec:

The values …

February 1, 201129 comments

Equal Height Blocks in Rows

A jQuery based solution for equalizing the heights of boxes across the horizontal row they are in. Different rows can have different heights. Originally by Stephen Akins.
January 31, 201179 comments

Ajax Load Container Contents

Use jQuery to replace a section of the page with that same section of the page from a different URL. The trick is to grab the contents of the section, not the section itself.
January 28, 201151 comments

CSS properties that affect type rendering

Tim Brown reminds us that:

When it comes to type rendering on the web, there’s not much web designers can do.

He's talking about literally how well type renders on the screen. There are a handful of properties that have …

January 27, 2011

Five Questions with Zoe Mickley Gillenwater

Zoe is a hero of the modern web. I first heard of her from her book Flexible Web Design, which is a super comprehensive and sensible look at building fluid width websites (and other techniques to make websites take …

January 27, 20118 comments

Unmatched Style Site Review

My buddies at Unmatched Style reviewed this here very site. Make sure to check out the video at the top where Gene and I talk about some of the design decisions and behind the scenes tech. …

January 26, 2011

humans.txt

I kinda like this idea:

It's a TXT file [at the root of your site] that contains information about the different people who have contributed to building the website.

A lot of websites should just have an about page where …

January 25, 2011

Native CSS Variables Closer To Reality

Tab Atkins Jr:

...the time until this starts showing up in nightly builds of Webkit is measurable in months.

and

...this is one of those things that you'll have to wait a decade for before you can reliably use in …

January 25, 2011

Animated Knockout Letters

I was watching some commercial the other day and they had these letters fly in over a black screen and reveal an image beneath them. It was a pretty cool looking effect and it reminded me how WebKit has that …

January 24, 201134 comments

The Shadow DOM

You know the little blue knobby on WebKit range inputs? And all those fancy <video> controls? That stuff is all built with regular ol' (styled) HTML elements, only they are behind a bit of a glass wall. You can see, …

January 20, 2011

Five Questions with Trent Walton

Trent is an easy guy to admire. He works at a cool design agency (they have a triforce for a logo and pull it off). He's got a cool blog that shows off his clean design style with art directed …

January 18, 201111 comments

Rotating Feature Boxes

Three boxes: a main feature box and two sub features. Click on the sub feature boxes and the whole shebang rotates to make that the main feature. The animations happen via CSS3 (the future) and the clicks and class shuffling is done by JavaScript (its forte).
January 17, 201152 comments

The Dark Side of Usability

There is some actual data supporting a counter-intuitive idea I postulated about a while back:

People using the more difficult interfaces tended to perform better, were less fazed by distractions and were found more likely to transfer their skills to …

January 15, 2011

WebKit Gradient Syntax

... is now the same as the Mozilla / Official spec version, which is great because 1) it's easier to write and technically more powerful and 2) yay standards!

It's only in the WebKit nightlies, but I'm sure will be …

January 15, 2011

Five Questions with Nicolas Gallagher

Nicolas has one of those web design blogs that everybody should subscribe to. He explains things with a thoroughness and understanding that we all should strive for. I caught up with Nicolas to ask him some questions about the future …

January 12, 201114 comments

Google Dropping H.264

Google Chrome is dropping support for the video codec H.264. Kinda feels like an Apple vs. Google pissing match as H.264 is so heavily used by Apple and WebM was developed by Google.

For HTML5 video, this is how it …

January 11, 2011

What’s the Difference?

Reader Paul writes in:

What's the difference between .container div { } and div.container { }?

It's great you are asking questions like this Paul. The answer is very important to understanding CSS, because these two selectors select very …

January 10, 201126 comments

Moving Highlight

I recently noticed a subtle and nice effect in the Google Chrome UI. As you mouse over inactive tabs, they light up a bit, but also have a gradient highlight that follows your mouse as you move around on them. …

January 9, 201144 comments

Mother Effing HSL

From the source code:

this site is by Paul Irish
i made it cuz hsla is wayyyy cooler than rgba and more sensible too!

HSL is better than RGB. The reason it isn't used as much (according to me) is …

January 5, 2011

Absolutely Position Element Within a Table Cell

Have you ever wanted to absolutely or relatively position a table cell? Well, I can't help you there. Table cell elements just won't take those position values. And thus, you also can't absolutely position elements within the context of those …

January 4, 201116 comments

Links

Got a couple of slightly-oldie-but-goodies for you:

  • A jQuery plugin by Manos Malihutsakis which allows you do to create custom scrollbars for content areas that do some neat things like move their position and size, style them differently, and use
January 3, 201119 comments

Why use Classes or IDs on the HTML element?

Reader Nicolas writes in:

I'm frequently seeing ID and class specifications to <body> and <html> elements. I'm curious as to why one would do this? If it is unique to either element, then why not specify body or html in …

January 2, 201150 comments

The MoveUp Menu

I got an email quite a while back from Dirk Tucholski who showed me a site called FLOWmarket. He was wondering about how the menu system worked. I thought it looked neat and so set out to build it …

December 30, 201037 comments

Thank You (2010 Edition)

It's been a tradition for years now around here for me to do a year-end wrap-up. It's a great way of reflecting on the year, sharing some random interesting statistics, and most importantly, saying thank you to everyone who comes …

December 25, 201072 comments

Striped and Checkerboard Backgrounds Without Images

Lea Verou with a clever idea on using CSS3 gradients that repeat (by setting background size) to create striped and checkboard backgrounds with no images.…

December 22, 2010

Poll Results: HTML5 on New Projects

Several folks pointed out that this last poll question was worded a bit strangely:

Would you start a new web project today and not use HTML5?

I worded it that way to elicit comments on why a person or organization …

December 22, 201068 comments

*May or may not contain any actual "CSS" or "Tricks".