Articles by

Chris Coyier

Founder, writer, designer, spam-deleter, email personality

Happy Halloween

HTML, CSS, and JavaScript got invited to a halloween party. They decided they would all dress up as each other!

HTML went as JavaScript:

<div id="pumpkin" onclick="alert('Boo!');"></div>

JavaScript went as CSS:

var jackolantern = document.getElementById('pumpkin');
jackolantern.style.color = "orange";
jackolantern.style.backgroundColor = 

Reset Admin Password Through Database

You’ll need to be able to run SQL on that database, like for example, through phpMyAdmin.

UPDATE `wp_users` SET `user_pass` = MD5( 'new_password_here' ) WHERE `wp_users`.`user_login` = "admin_username";

Rotating Molecules with 3D Transforms

Direct Link

Click-and-drag to rotate these complex objects through a pseudo three dimensional space. It’s a familiar design pattern, but one that is particularly difficult to pull off. No Flash, not even canvas. Just some fancy JavaScript and CSS (WebKit 3D Transforms). …

So You Need To Fill a Dropdown Dynamically

You have one dropdown menu, and depending on the user’s choice in that one, a second dropdown gets filled with choices. Let’s cover three different ways you can go about that.…

(Updated on )

Change WMode with jQuery

If you don’t set the wmode on a flash embed it will float over the top of an overlay which can be a pretty big deal. This is ideal in environment with lots of legacy video code or where users …

Get ID from Page Name

Add to functions.php file:

function get_ID_by_page_name($page_name) {
   global $wpdb;
   $page_name_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '".$page_name."' AND post_type = 'page'");
   return $page_name_id;
}

Now you can use this function in templates when you need an ID of …

Garage Door Style Menu

Originally published on July 21, 2008 as only a jQuery technique. Now updated to include CSS3 and a combo technique which is mo’ betta.

A garage door style menu is where an image (the “door”) slides up to reveal something …

(Updated on )

Parent Selectors in CSS

Let’s be clear here, just in case someone is finding this from a search engine: there are no parent selectors in CSS, not even in CSS3. It is an interesting topic to talk about though, and some fresh talk …

(Updated on )

Formalize CSS

Direct Link

Framework by Nathan Smith for nice looking, HTML5 ready, progressively enhanced, cross-browser forms.…

Load jQuery Only If Not Present

Say you were going to do an include on a whole bunch of pages, and inside of that include you wanted to do some jQuery specific stuff. That page may or may not already have jQuery loaded. If it already …

(Updated on )