Grow your CSS skills. Land your dream job.

Article Archives

60 comments

Slider with Sliding Backgrounds

Among the many super nice design features of the Yahoo! Weather app for iOS is the transition between city screens. The background image doesn't just move away as the screen moves from one screen to the next, the background image …

38 comments

Photo Swivel

The following is a guest post by Alex Young (@the_alexyoung). Alex has created a simple technique to "rotate" the subject of a photo simply by hiding and showing multiple stacked photographs taken at different angles. Enjoy!

63 comments

Naming Media Queries

It would be pretty cool if we could do this someday in CSS. The best idea for it that I've come across is to define it in a <meta /> tag in the <head></head>. That way (perhaps) CSS could …

29 comments

Line Clampin’ (Truncating Multiple Line Text)

You want X lines of text. Anything after that, gracefully cut off. That's "line clamping" and it is a perfectly legit desire. When you can count on text being a certain number of lines, you can create stronger and more …

How to mark up subtitles

Now that <hgroup> is gone, use a <span> inside the main header, or group them with <header> and use a <p> for the subtitle.…

33 comments

3D Inset Parallax Effect

The following is a guest post by Joshua Bader. Joshua noticed that certain 3D effects on the web could benefit from adjusting perspective as the web page is scrolled. I'll let him explain.

People love to make flat things …

52 comments

Make Client Side Data Available Server Side

That would be pretty useful, right? Right now it's very common to User Agent "sniff" when you want to make a server-side decision about what to give the client. But UA sniffing has always sucked and sucks more every day. …

WebP with Fallback

WebP images will save a quarter to a third of the file size over PNG or JPG. Not all browsers are going to support it, but Bruce Lawson shares a way we can use it in such a progressive enhancement …

The CSS-Tricks License

Sometimes people ask me if they can use the stuff they find here. So I thought I'd create a license I can refer them to. …

CSS3 Overflow

Not the most glamorous property is it? But it just might turn out to be. Things like paginated overflow and overflowing into fragments, each of which is selectable and style-able. Could be pretty powerful! Like replacing sliders with browser native …

35 comments

Magic Numbers in CSS

Despite the super fun sounding name, magic numbers are a bad thing. It is an old school programming term for "unnamed numerical constant". As in, just some number plunked into the code that is probably vital to things working correctly …

WP Migrate DB Pro

I think the most common tech question we get on ShopTalk show is how to keep a WordPress database in sync between live and local. This (paid) plugin can do it right from one admin screen to another by POSTing …

38 comments

Preventing the Performance Hit from Custom Fonts

The issue is 1) custom fonts are awesome and we want to use them 2) custom fonts slow down our pages by being large additional resources. Dealing with this has been in the air recently so I thought I'd round …

49 comments

Line-On-Sides Headers

Forums user McAsh wondered how they might code up a design in which there was a large header and a smaller subheader beneath it which featured double horizontal lines jutting out after the text to both the left and right …

List of Pseudo-Elements to Style Form Controls

Like the little handle on range inputs. You can style that, but it's different in all the major browsers. It's either ::-ms-thumb, ::moz-range-thumb, or ::-webkit-slider-thumb. Obviously an area that would benefit from standardization. …

24 comments

Transitional Interfaces, Coded

Pasquale D’Silva’s article Transitional Interfaces has really been making the rounds. It's a quick read that drives home a great point. Transitions and animations can be more than eye candy. They can help give your brain a clue about what …

csscss

A CSS redundancy analyzer that analyzes redundancy.

Gives you output like:

{.contact .content .primary} and {article, #comments} share 5 rules

If you have multiple selectors sharing five or more rules (properties with the same value), that's likely a good opportunity …

14 comments

CSS-Tricks Chronicle XII

SITEOWNR: Thers new ifnormation inthe site foryou. (puts on sunglasses). STRETEMAN: yesyes Im hapy !
36 comments

Body Border, Rounded Inside

Reader Arun wrote in with a question on how to make a body border that was rounded where the edges met on the inside. Like this. We've covered body borders before, but this was slightly different. …

Blink

Chrome is going to use "Blink" as a rendering engine now, a fork of WebKit. I imagine the Chromium team will stop committing back to WebKit, so that project will stagnate a bit. Safari is already rather slow to update, …

48 comments

Pop Hovers

POP has these cool hovers in the boxes that make up their homepage. The boxes have a white background by default, and as you hover over them a dark background slides up behind, the text colors change, and the text …

SVG Patterns Gallery

Using SVG for background patterns is great because they 1) are very small 2) are vector, thus crisp at any screen resolution and 3) work in IE 9 (unlike gradients). Gallery by Philip Rogers.…

20 comments

Poll Wrapup: How Much Effort Do People Put Into Alt Text?

From over 16,000 people surveyed, more than half (54%) say they "do some" when it comes to alt text for images that are important to content. The example provided did provide insight into the content and relevance of the image.…

The State of Spinners

If you need to indicate "please wait, something is happening" on a website, a spinner has long been the go-to choice. Probably an animated GIF, although there are other options like CSS animations, apng, SVG, or canvas. James Padolsey …

68 comments

Slide In (as you scroll down) Boxes

I was playing with my new Nexus 7 (I really wanted to own a real Android device) and I noticed a neat little effect in the Google+ app that comes with it. As you swipe down, new modules of content …

51 comments

Let’s Say FeedBurner Shuts Down…

A lot of us around here have blogs and a lot of us use FeedBurner to "host" our RSS feeds. I thought it was worth talking about what might happen if we lose FeedBurner, which seems especially likely these …

Printing the Web

Hans Christian with the state of web printing. All the old classics are still important, like display: none; on irrelevant stuff (like navigation) and using pseudo elements to display the URL's of links. But there are new kids on the …

45 comments

Hang On Placeholders

The way that placeholder text works on inputs and textareas is either that 1) the placeholder text disappears immediately when the empty input is focused or 2) the placeholder text stays until actual text is entered. Perhaps a middle ground could also make sense.
14 comments

There’s more to the CSS rem unit than font sizing

Many web designers and developers are familiar with the CSS rem length unit. But, you may not know that it has a couple of handy alternate uses. In this post, I’ll describe how to use the CSS rem unit to scale specific page elements while leaving others unaffected. I’ll also discuss how to use it as a replacement for the under-supported vw (viewporth width) unit.
22 comments

Tricky Textarea Pulltab

In desktop Safari, Chrome, Firefox, and Opera-under-Presto, (not IE, not mobile anything) <textarea></textarea>s have a little resizer nugget in the bottom right corner. Textareas are for writing in, so if users need more space to feel more comfortable writing …

77 comments

Automatic Table of Contents

Any long page of content with distinct and well marked up content can benefit from a table to contents. A table of contents provides a quick way to jump down the page to the desired section. Of course you can …

Finer Grained Control of Hyphenation

David Storey shows off the latest work-in-progress CSS Level 4 stuff for hyphenation. Like properties to make sure multiple subsequent lines don't hyphenate ("ladders"), how many characters need to be left on the old line and new line, and what …

Learn CSS Layout

Learn by seeing examples and code together in an easily digestible page-by-page format. Works on screens large or small, which we all know is darn important these days. By Greg Smith and Isaac Durazo.…

Responding to Voice

Jordan Moore experiments with talking to the browser to adjust how things look. For instance, "Make the text larger." Like in, you know, the future.…

5 comments

CSS-Tricks Chronicle XI

A brief summarization of the events that have been and events that are to be. Wherein ‘events’ refers literally to physical events as well as figuratively as in ‘some kind of thing that happened, loosely.’

Client-Hints

We all know UA sniffing sucks. But it's really common because there is a real need to know stuff about the browser on the other end when serving up content and resources. What if instead of just a UA string, …

Flat UI

Really nice set of user interface elements from the folks at Design Modo. This style is hitting a real design nerve right now. I like how they went the extra mile and made all the components actually work (e.g. sliders …

Quotes & Accents

Reminders about what keys to press to get curly quotes and accented characters by Jessica Hische. I'm a major offender (SEE?!). I should be writing in Markdown which automatically fixes it. …

151 comments

Using SVG

SVG is an image format for vector graphics. It literally means Scalable Vector Graphics. Basically, what you work with in Adobe Illustrator. You can use SVG on the web pretty easily, but there is plenty you should know.…

35 comments

Mixing Responsive Design and Mobile Templates

You need a mobile strategy for your site. You have to pick Responsive Design or a dedicated mobile site, right? Maybe not. Maybe you can mix and match a variety of strategies.…

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