Skip to main content
CSS is fun and cool and I like it.

Including Navigation Code On All Pages (Even With Current Navigation Highlighting!)

You've seen this a million times:

  <li><a href="#">Home</a></li>
  <li><a href="#">About us</a></li>
  <li><a href="#">Contact us</a></li>

The classic menu HTML which you can transform into any number of beautiful things through CSS. You could include that in all your pages by putting it into it's own HTML file (like "menu.html") and including it on your pages with some kind of simple include statement like this PHP snippet:

<?php include_once("menu.html"); ?>

Now you need to add a class so you can … Read article


Designing For A Lightbox

The 37 Signals Blog, Signal vs. Noise, has a post about a month ago with an interesting observation:
"Designing for the iPhone is like a hybrid of print and web design."

Their point was with the iPhone, you know the exact size of the screen, you know the exact browser, you know how fonts will look in that browser, you know what the screen is like and all the capabilities. That is so very different from web design, which is … Read article


At @ Rule CSS

The default way to include an external stylesheet is to use the the link tag inside your pages head:

<link rel="stylesheet" href="default.css">

That is a tried and true method and supports the whole spectrum of browsers from old and ancient to hip and modern. But let's say you grown tired of the old and ancient... You don't want your page to be completely unusable, but you would rather it look completely non-styled than broken and clumsy. You could use an … Read article


Expandable CSS “Note” Box

Creating vertically-expanding boxes is easy, just declare a width in your div CSS but no height. The div will expand to as large as it needs to be for the content inside. It gets a little more complicated if you want to apply styling to those boxes with images. If you want to use an image just on the top of the box, you can apply a background-image to the div and set it's position to be top left, top … Read article


HTML Declarations Screwing Up CSS

Has your CSS ever been acting funny on you, but it looks as if you've done everything perfectly? It just might be your HTML declarations that are screwing you up. Sometimes when you are just throwing together a little sample, you just use the <html> tag to start your page and everything works just fine. As things get more complicated, and you forget to use a "real" declaration, you may notice things not behaving as you intended. For example, using … Read article


Clean Up Your CSS

Cascading Style Sheets, at its root, is intended to separate the style of a webpage from the content. That makes sense for control reasons, but also for general code beautification. Just a little browsing through the CSS Zen Garden or some of the great articles on CSS design from Smashing Magazine and you can see the beautiful things CSS can do.

If the results of CSS are so beautiful, should the CSS itself be beautiful? Keeping your code pretty is … Read article


A Bulletproof Sticky Footer, Woohoo!

Footers on web pages are a great place to chuck copyright information, contact links, and quick navigational stuff. Visitors are trained to look to the bottom of pages to find these types of things, so why not help them out? One problem is that on pages that are a bit vertically challenged, the footer might end up in the middle of the page instead of down at the bottom of the browser window where it should be.

We have a … Read article


Creating Clickable DIVs

DIV's are a must in all CSS-based web design. They give you all kinds of fantastic positioning ability and give structure to your HTML. You can put links inside of a DIV, of course, but sometimes you just want the whole DIV to be clickable as a link. No problem, here is how it's done:

<div onclick="location.href='YOUR-URL-HERE';" style="cursor: pointer;"></div>

The cursor style parameter changes the cursor into the default pointer cursor when a vistor mouses over the DIV, which is … Read article


CSS Menu With Rollover Images

We just posted on the nastiness of javascript-based rollovers. We showed you the basics of how to do it with CSS instead, but now it's time to put our money where our mouths are and provide a real example.

This menu example uses three possible states:
- Normal
- Rollover
- Selected

The code is really clean and simple and should be easy to understand. Feel free to download the example and do whatever your little hearts desire with it. … Read article


Reset all Margins & Padding

* {
margin: 0;
padding: 0;

This has become a very popular technique lately, and for good reason. It removes all default margin and padding for every object on the page, no holds barred, regardless of browser. This provides a nice clean slate for design and ensures that all spacing is intentional, explict, and ubiquitous across browsers. There is no reason not to do this.

Some people like to include border: 0; as a part of it, but it … Read article

icon-link icon-logo-star icon-search icon-star