WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I enqueue a .css file before style.css is loaded? Or make the default style.css dependant on another .css file?

I'm trying to load a .css reset, which style.css would overwrite.

Here's what I have:

add_action('wp_enqueue_scripts', 'load_css_files');

function load_css_files() {
    wp_register_style( 'normalize', get_template_directory_uri() . '/css/normalize.css');
    wp_enqueue_style( 'normalize' );

However this is loaded after style.css.

share|improve this question
up vote 11 down vote accepted

Enqueue the style.css too, and set normalize as dependency:

function load_css_files() {
    wp_register_style( 'normalize', get_template_directory_uri() . '/css/normalize.css');
    wp_register_style( 'theme_name', get_stylesheet_uri(), array( 'normalize' ));
    wp_enqueue_style( 'theme_name' );

WordPress will load the dependencies now first automatically when theme_name is printed.

share|improve this answer
Great, thanks! Just a quick question - do I then not need to enqueue the normalize style, or is this done automatically when set as a dependency? – vonholmes Apr 17 '13 at 11:51
Automatically enqueued when called as a dependency. – RRikesh Apr 17 '13 at 11:52
@vonholmes I have added that to my answer. – toscho Apr 17 '13 at 11:55
Awesome, thanks for your help and explanation. – vonholmes Apr 17 '13 at 11:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.