Title: stylesheet precedence
Last modified: August 21, 2016

---

# stylesheet precedence

 *  Resolved [brsastre](https://wordpress.org/support/users/brsastre/)
 * (@brsastre)
 * [12 years ago](https://wordpress.org/support/topic/stylesheet-precedence/)
 * I have created a child theme.
    Sometimes, when i create my own custom css rules
   on style.css (child) to override existing rules from the theme, i found that 
   they would not apply, because style.css (child) is being compiled before other
   stylesheets from the theme. Of course, i could make use of the !important rule,
   but i rather not.
 * What i would like to do insted, is to tell style.css (child) to be compiled after
   all the other stylesheet from the theme, that is, at the bottom. That way, every
   custom rule will override preceding rules. Right?
 * how do i tell wordpress to do that?
    Is this technique convenient?
 * Appreciate some help.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [12 years ago](https://wordpress.org/support/topic/stylesheet-precedence/#post-4870228)
 * > Of course, i could make use of the !important rule, but i rather not.
 * Can you instead use more specific selectors?
    _[http://www.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/](http://www.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/)_
 * > That way, every custom rule will override preceding rules. Right?
 * Not if the other stylesheets use more specific selectors.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [12 years ago](https://wordpress.org/support/topic/stylesheet-precedence/#post-4870229)
 * Are you talking about the theme’s stylesheets (other than style.css) taking precedence,
   or plugin stylesheets, or both?
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [12 years ago](https://wordpress.org/support/topic/stylesheet-precedence/#post-4870236)
 * > because style.css (child) is being compiled before other stylesheets from the
   > theme
 * try to change the way the style.css of the child theme gets linked; possibly 
   enqueue the stylesheet with a different priority to have it executed after all
   the other stylesheets.
 * what theme are you using?
 * [https://codex.wordpress.org/Function_Reference/wp_enqueue_style](https://codex.wordpress.org/Function_Reference/wp_enqueue_style)
 * example code (untested):
 *     ```
       function anychild_setup() {
       add_action( 'wp_enqueue_scripts', 'anychild_css_files', 99 ); //set priority here//
       }
   
       add_action( 'after_setup_theme', 'anychild_setup' );
   
       function anychild_css_files() {
       		wp_enqueue_style( 'anychild_style', get_stylesheet_directory_uri() . '/style.css' );
       }
       ```
   
 *  Thread Starter [brsastre](https://wordpress.org/support/users/brsastre/)
 * (@brsastre)
 * [12 years ago](https://wordpress.org/support/topic/stylesheet-precedence/#post-4870241)
 * **Volunteer Moderator:**
    – Yes, i could use more specific style, but i rather
   not for the same reason i prefer not to use !important. Because i want to do 
   the things right. Why would i use a more specific rule, when i want to refer 
   to the same exact element? And, i would need to be more specific every time i
   encounter the same problem. I think placing style.css (or any stylesheet i use
   to write my own custom styles) at the bottom, it’s a more simple and elegant 
   approach (personal opinion).
 * – yes, i am talking about theme’s stylesheets.
 * I couldn’t find where to upload an image after i started the thread. So i uploaded
   it to my google drive:
 * [https://docs.google.com/document/d/1H1GZMKRABKA2mjU68sx_AbtjumoX_pWca3XPR3zXJZk/edit?usp=sharing](https://docs.google.com/document/d/1H1GZMKRABKA2mjU68sx_AbtjumoX_pWca3XPR3zXJZk/edit?usp=sharing)
 * **alchymyth**
    – I am using “bule diamond”. That is exactly what i was refering
   to. Thanks so much.
 * Really appreciate the help guys, thanks so much. 😀

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘stylesheet precedence’ is closed to new replies.

## Tags

 * [precedence](https://wordpress.org/support/topic-tag/precedence/)
 * [style.css](https://wordpress.org/support/topic-tag/style-css/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [brsastre](https://wordpress.org/support/users/brsastre/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/stylesheet-precedence/#post-4870241)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
