Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Alex Flores
Alex Flores
7,864 Points

Inline css overriding child style.css

I'm working with Wordpress and child themes. I have everything working, but the parent inline css is overriding my child css stylesheet. I use !important to override the parent inline css, but is there not an easier way to do this?

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

Couldn't you take out the inline styles and either include them on your parent theme style.css file and/or child theme CSS file? If you need high specificity try including them as ID attribute selectors. :-)

1 Answer

Nattapol Kamolbal
Nattapol Kamolbal
15,528 Points

For what I can think of, there's no easy way to cope with this problem. If you can change the theme (maybe on your next project), look for cleaner one with no or less inline style.

For the alternative, you can replace the parent template file with no-inline version on your child theme. Just copy the template file you want from the parent theme and paste in child theme folder. Then delete the inline code you want to get rid off. This will make your page and css code easier to read. (but a lot of work though).