Quality Abbreviations

Slightly lighter color (assuming your text is black), dotted bottom border, and a question-mark cursor. This has become a somewhat standardized approach, which is always a good thing in design usability.

abbr {
 border-bottom: 1px dotted #222;
 color: #222;
 cursor: 
Avatar of Chris Coyier
Chris Coyier on

Show Off Your Sprites!

I just updated my old CSS Sprites article yesterday, and I thought it would be kind of fun to ask everyone to share sprites that they have created themselves. Let’s make a quick giveaway out of it too!…

Avatar of Chris Coyier
Chris Coyier on

Fixed Positioning in IE 6

* { margin:0; padding:0; }
html, body {
   height: 100%;
}
body #fixedElement {
   position:fixed !important;
   position: absolute; /*ie6 and above*/
   top: 0;
   right: 0;
}
#page-wrap {
    width: 600px;
    margin: 0 auto; 
    font: 16px/2 Georgia, Serif;
}

The 100% …

Avatar of Chris Coyier
Chris Coyier on

Randomize Background Image

1. Above the DOCTYPE

Set up and array of filenames, which correspond to the file names of the images you are trying to randomize.

<?php
  $bg = array('bg-01.jpg', 'bg-02.jpg', 'bg-03.jpg', 'bg-04.jpg', 'bg-05.jpg', 'bg-06.jpg', 'bg-07.jpg' ); // array of filenames

  $i 
Avatar of Chris Coyier
Chris Coyier on

Display Styled Directory Contents

Servers can be configured to show the contents of a directory that doesn’t have an index file to render. The result is usually less than visually spectacular:

Lackluster default in Chrome More better, View Demo

We can take control of …

Avatar of Chris Coyier
Chris Coyier on (Updated on )

Fixing IE z-index

This isn’t an end-all-be-all solution to fixing all weird IE z-index issues, but it certainly can help in some circumstances. What it does is loop through each of the elements that you declare and apply ever-declining z-index values on them. …

Avatar of Chris Coyier
Chris Coyier on

Comments in JavaScript

function doSomething() {

    /*
           This code by Chris Coyier
    */

    var i = 0;    // counter to be used later;

}

Comments in JavaScript can be between /* */ markings (useful for multiple line comments) or after // markings (for …

Avatar of Chris Coyier
Chris Coyier on

Comments in PHP

<?php

    /*
           This code by Chris Coyier
    */

    $i = 0;    // counter to be used later;

?>

Comments in PHP can be between /* */ markings (useful for multiple line comments) or after // markings (for single lines only).…

Avatar of Chris Coyier
Chris Coyier on

Comments in CSS

Example:

/*
  This is a 
  comment in CSS
*/
body {
  font-family: system-ui;
  font-size: 62.5%  /* 1em = 10px */
  line-height: 1.4;
}

The stuff inside the /* */ marks are CSS comments. This allows you to enter notes into …

Avatar of Chris Coyier
Chris Coyier on (Updated on )