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 How to Make a Website with WordPress Customizing WordPress Themes How to Make Child Themes

Robert Vander Steen
Robert Vander Steen
3,525 Points

Why import the parent theme css

Do you have to import the parent theme css?

5 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

You don't actually need to import the parent theme. Only if you want to have the same styles of the parent theme apply to the child do you need to do this. If you only plan to use the markup from the parent theme then you don't have to do the @import

Matt Campbell
Matt Campbell
9,767 Points

Yes to overwrite the parent themes styles etc.

Robert Vander Steen
Robert Vander Steen
3,525 Points

But I thought this could be achieved by creating a syle.css in the child theme folder with only the changes i.e without imprting the parent style.css?

If you modify parent theme CSS and it is updated, your changes will be lost. With a child theme, you can update the parent theme and still keep your changes up. Import of CSS is important so that you can keep design of parent theme maintained with child theme. Purpose of child theme is to modify parent theme functionality as per your requirements not to create a completely independent theme from parent theme.

Robert Vander Steen
Robert Vander Steen
3,525 Points

Agree with both previous answers. i.e I understand that the parent theme should not be modified.

I understood that a style.css in the child theme folder need only include the required changes to the parent folder style.css i.e there is no need to import the parent style.css into the child style.css. Am I wrong?