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 trialRobert Vander Steen
3,525 PointsWhy import the parent theme css
Do you have to import the parent theme css?
5 Answers
Zac Gordon
Treehouse Guest TeacherYou 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
9,767 PointsYes to overwrite the parent themes styles etc.
Robert Vander Steen
3,525 PointsBut 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?
Mohammed Arif
Courses Plus Student 92 PointsIf 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
3,525 PointsAgree 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?