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 trialRon Q
463 PointsHow do you create the style.css file for our own projects?
I am new to child themes. I pasted in the project css and see how that works but I am confused on how to create our own style.css file that has all that info in it for our own websites. Thanks.
3 Answers
Paul Mather
3,313 PointsYou need to create a new folder in the /themes/ directory, call it what you like but something logical. You then need to create a new file name style.css inside of that folder (or create it locally and upload to the folder) - the start of the style.css file needs some information so it can be properly declared a child theme - the code you need for this is below - edit it accordingly.
Theme Name: The name of your theme
Description: Description to be displayed in the WP back-end
Author: Your Name
Template: twentyfourteen
Version: 1.0.0
*/
@import url("../twentyfourteen/style.css");```
Ron Q
463 PointsOk, thanks. So the most important parts are the Template and version # of template and the import part right?
So only if you are making changes to the css do you need to create a child theme right?
Paul Mather
3,313 PointsYou always need the parts included above - you can create the child theme without these, but it isn't advised (actually you don't really need the version number, but i always use it). You MUST include the @import otherwise the basic styling from the parent theme won't be used in your child theme.
You create a child theme for making edits to a theme, yes - this way when Wordpress is updated your CSS changes are in tact, since they're located in a child theme folder (i.e. not a core part of Wordpress, for which files are overwritten when Wordpress is updated).