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 trialUlises Calvo
2,233 PointsSo it is a good practice to inline that CSS?
Just wondering, I have seen forums in which they mention creating a css.php file, what would be a better practice?
3 Answers
Luke Pettway
16,593 PointsTypically you will load stylesheets externally, as it makes your document smaller. There is an argument for inlining critical CSS in your header, which is anything that would be within the window on load. For most sites though stick to loading in your style.css like normal.
Leroy Sibisi
20,619 PointsHaving an external style sheet, your work will be more presentable and easy to read.
Ulises Calvo
2,233 PointsThat's what I thought... :)
Konrad Pilch
2,435 PointsWhat do you mean css.php file?
I only know that if your making a WP theme you can use inline CSS for things such as images since you can't modify CSS with WP , so any image will be off the road.
If you style background: path .. you can do it inline with CSS when doing WordPress stuff.
Ulises Calvo
2,233 PointsActually they call it layout.php . I think I would stick to what Zac does on this lesson. Thank you Konrad.
Ulises Calvo
2,233 PointsUlises Calvo
2,233 PointsZac creates a <styles> tag withing the functions.php with some CSS in it in order to display the styles for the header text and disappear the header text when the checkbox is clicked in the customizer. I in my case had to write a whole bunch of CSS declarations to achieve the results that I needed to style my header text. That is why I asked that question, it feels like to much CSS to be written in a functions.php file. But I'm just learning, maybe that is the customary thing to do. Thank you Luke.