Category Archives: Quick Tip

Substitute :last-child for :first-child for IE 7 support

Consider the following:
ul li {
   display: inline;
   margin-right: 10px;
   padding-right: 10px;
   border-right: 1px solid red;
}
ul li:last-child {
   margin-right: 0;
   padding-right: 0;
   border-right: 0;
}
This bit of CSS would give you perfect line separators in IE8+. But since IE 7 supports the :first-child pseudo-class, we can do one better:
ul li {
   display: inline;
   margin-left: 10px;
   padding-left: 10px;
   [...]

RGBa makes a great debugging tool

With 24 Ways pushing RGBa into the foreground today, I thought I’d share a quick debugging tip. Using RGBa can help while you’re debugging element positioning. For the adventurous, combine with a debug class:
.debug {
  background: rgba(255, 0, 0, 0.5);
}