CSS Box Shadow

Used in casting shadows off block-level elements (like divs).

.shadow {
  box-shadow: 3px 3px 5px 6px #ccc;
}
  1. The horizontal offset of the shadow, positive means the shadow will be on the right of the box, a negative offset will
Avatar of Chris Coyier
Chris Coyier on (Updated on )

“Go Back” Button

Browsers already have “back” buttons, so you’d better have a darn good reason for needing to put one on your page!

Input button with inline JavaScript

<input type="button" value="Go Back From Whence You Came!" onclick="history.back(-1)" />

This is totally obtrusive, …

Avatar of Chris Coyier
Chris Coyier on

Embedding Windows Media

Valid technique, as it doesn’t need the <embed> tag.

<object type="video/x-ms-wmv" 
  data="movie.wmv" 
  width="320" height="260">
  <param name="src" 
    value="movie.wmv" />
  <param name="autostart" value="true" />
  <param name="controller" value="true" />
</object>
Avatar of Chris Coyier
Chris Coyier on

Embedding Quicktime

Quicktime still requires the double-object method to get it done across all browsers. Not super pretty, but it does get the job done.

<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
       codebase="http://www.apple.com/qtactivex/qtplugin.cab"
       width="200" height="16">
 <param name="src" value="movie.mov" />
 <param name="autoplay" value="true" />
 <param name="pluginspage" value="http://www.apple.com/quicktime/download/" />
 
Avatar of Chris Coyier
Chris Coyier on

Remove WP Generator Meta Tag

It can be considered a security risk to make your wordpress version visible and public you should hide it.

Put in functions.php file in your theme:

remove_action('wp_head', 'wp_generator');
Avatar of Chris Coyier
Chris Coyier on

Error Page to Handle All Errors

This is a way to make a single error page for all errors, which is easier to update and maintain.

1) Point all error pages at one location in your .htaccess file

ErrorDocument 400 /error.php
ErrorDocument 401 /error.php
ErrorDocument 403 
Avatar of Chris Coyier
Chris Coyier on

Smarter Event Binding

$("p").live("click", function(){
      $(this).css("color", "red");
});

The reason this is smarter is because there are likely many p elements on the page. If there were, say, 10 of them, traditional click event binding would require 10 handlers. The live function only …

Avatar of Chris Coyier
Chris Coyier on