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

Article Archives

35 comments

Fun With Blurred Text

We'll cover how to blur text with CSS3 and do it safely by feature-detecting first. Then we'll do a bunch of experiments with individual letter blurring and also some clever jQuery which gives us deeper access into specific values of a text-shadow.

CSS vs CSS3

Trent Walton designs a website then codes it up two ways: new school CSS3, and old school image slicing with no CSS3. Going new school meant 1) he could do it faster 2) the page size was smaller 3) less HTTP requests needed and 4) it's easier to update. Not that you all need convincing around here.…

Micro Clearfix

Nicolas Gallagher challenges some old assumptions about what's needed to make the pseudo element style "clearfix" work. …

60 comments

Faking ‘float: center’ with Pseudo Elements

Using a couple of floated pseudo elements on the elements containing columns of text, we can knock out a part in the middle making it look like text is wrapping around an image both directions.

CSS Gradient Patterns Gallery

Gradient wizard Lea Verou compiles all her crazy I-didn't-know-that-was-possible patterns into one library with easy to snag code samples. Make sure to click the patterns for full screen view.…

16 comments

Value Bubbles for Range Inputs

HTML5 range inputs, in supported browsers and by design, don't show the user the actual value they are submitting. If you want to use the cool slider, but show the value, you'll have to do that yourself. Here we use the output element and jQuery to show the current value in a bubble that hovers above the range input.

IE 10

Right on the heels of IE 9's release, there is already a platform preview for IE 10 (video).

Awesome: Flexbox, Grid, Multi-column, Gradients, (and soon), Transitions and 3D Transforms

Not awesome: No text shadow, No HTML5 Forms support…

Front End Design Conference

July 22, 2011 - St. Petersburg, Florida. This is the third year going. Two years ago, I spoke at the first one which was my first "real" speaking gig ever. This year I'll be talking CSS, which, strangely enough, I've never talked about live before. Specifically, pseudo elements.…

:any()

Marco Kuiper with some real world examples of how the :any() selector (already live in Firefox 4 and WebKit nightlies) can clean up otherwise clunky selectors. …

48 comments

Play Sound on :hover

Use JavaScript to trigger the playing of a sound (an HTML5 audio element). A couple of ways to do it are presented here, along with a few gotchas to watch for.

WhatFont Bookmarklet

  1. Oooh that's a nice looking font!
  2. Click bookmarklet
  3. Hover over font
  4. Font name knowledge acquired.

The Cicada Principle

So there is this bug... also prime numbers... and... just read it it's really neat and has practical web design implications. …

36 comments

What if there was no position: static;?

A fun thinking exercise for CSS nerds! What if all elements defaulted to relative positioning instead? What are the advantages, disadvantages, and caveats to consider...
25 comments

Reveal a Background Image upon Text Selection

Highlight text, reveal an actual image beneath! Not possible with the text selection pseudo class, but is possible by wrapping selected text in spans via an open source JavaScript library and adding the background image to that.

Glowform

Super hot color gradient glowing action by Kayla Rose.…

Absolutely Positioned Textareas

Snook reminds us we can set the top/left (or bottom/right) when absolutely positioning textareas, but not all four values (which cannot out-force the width/height). …

Griddle

Get a gridded up background-image on-the-fly.
61 comments

Slide In Image Captions

Reader Jason Lucchesi send me in a neat demo of image captions sliding in overtop an image on rollover. The effect used a bunch of nested divs to get it done, so I thought I'd do my own version of it using the standard HTML5 structure for an image with a caption, and CSS3 it up.…

41 comments

CSS Pivot

CSS Pivot allows you to apply your own CSS to a site and then share the results (you get a unique URL which opens up that site in a top-bar/iframe dealy). Pretty clever stuff. If you saw a tweak of someone elses that you really liked and wanted to make it persist, you could use this Chrome extension.

I'm posting this as an article instead of a link so we get the comment thread thing going if anyone has …

58 comments

Hover on “Everything But”

Hover states are easy, but what if you want to apply a hover state to every element besides the one you are hovering over? We can do it with a little trickery.

Converge SE 2011

June 24-25, 2011 in Columbia, South Carolina. It was awesome last year and this year should be ever better as it's at a nicer venue and I'll be speaking at it! $150 bucks for both days = super affordable as far as these things go.…

6 comments

Comma Separated WebKit Animation Keyframes

Another little thing I learned from Estelle at the SXSW 2011 CSS3: Beyond The Basics panel was that you can comma separate the keyframe values in a WebKit animation declaration. Let's say you wanted to create a pulsing effect as an animation. One way to do that would be to have an animation which changes the opacity on 0% and 100% and then set the iteration-count to have it run a couple of times. But you can accomplish the same …

ZEN Audio Player

Really cool audio player by simurai using HTML5 <audio, jPlayer (jQuery plugin), and CSS3 for the fancy animations. This made the rounds a few months back but I decided to wait until it was on GitHub, which then happened and I missed it. Oh well, it is now and it's awesome.…

Get Your CSS Easing Code Here

A code generation and visualization tool by Matthew Lein for CSS3 transition timing functions. Biggest triumph? Making cubic bezier understandable. …

32 comments

IEMobile Conditional Comment

Heads up: there is a conditional comment for targeting Internet Explorer on Windows Phone 7 mobile devices. Plus, other random thoughts.
7 comments

Crivestivus

This has almost nothing to do with web design, but I want to help promote an event going on in Northern Wisconsin put on by some friends of mine: Crivestivus.

They used to hold it just for friends and friends-of-friends, but this year it's opening up to the public. It's like a very casual three day camping party. Live music (my old Irish band is getting back together and playing), outdoor games like bocce and cornhole (one year they …

94 comments

New Poll: Conditional Tags for All Browsers

There is a very low chance this would ever happen, and as far as I know nobody is talking about it seriously. I think it might make for an interesting discussion and poll though:

Do you wish there was conditional comments for all browsers?…

18 comments

currentColor

CSS variables are always a hot topic when "the future of CSS" is discussed. They are actually coming natively, but using them in production (without a CSS preprocessor framework) is a long way off. However there is a feature that actually has some browser support now that has a CSS variable feel to it, and that's the currentColor value. …

49 comments

Progressively Enhancing HTML5 Forms

This is what I'm thinking is the best current way to progressively enhance forms. That is, use HTML5 features when they are available and fall back to JavaScript alternatives when they are not. …

SXSW + HTML5 Forms

If you are at SXSW, Kevin Hale and I are talking about HTML5 forms and using them to improve lead generation (and generally how to make your forms better). It's a 2.5 hour workshop which we intend to be fun, ultra comprehensive, and practical. Between Kevin's ability to give super engaging presentations and my ability to make fart jokes (and the ridiculous amount of research I've done on this), it should be hopefully be a good one. Tuesday March 15, …

41 comments

Wolf in Sheep’s Clothing

Roger Johansson has a neat quick-tip style article on centering page content both vertically and horizontally by making the html element display: table; and the body element display: table-cell; with vertical-align: middle;. See the full code to make it happen in the article.

I'm down with that. Works in all modern browsers and IE 8 plus.

I disagree on this though:

I’ve seen people saying that using these CSS properties to create “CSS tables” is no better than using …

59 comments

Styling Texty Inputs Only

A CSS3 technique for selecting only texty inputs, without the burdon of listing every single attribute selector for every single new HTML5 input type. Plus alternates.

Method & Craft

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

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.…

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?
I guess there is no one to blame
We're leaving ground
Will things ever be the same again?…

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 presentation that is solely on that topic and it's going to be awesome.…

102 comments

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?

I do have some thoughts on that...…

57 comments

Show and Edit Style Element

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

54 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.

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 still a clever programatic way to accomplish this common design need. Plus you could always just snag a screenshot of the noise and use that in production.…

34 comments

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 them all grouped together. What isn't obvious while looking at the syntax is which image is on top in the vertical stacking order when those images overlap. The spec is clear in this regard and browser implimentations follow. The first …

47 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.

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 using multiple backgrounds on the <body> all with different positions, sizes, colors, etc.…