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

CSS

Shams Nelson
Shams Nelson
2,888 Points

Can css be used to store a header or footer html data?

I'm not sure is I'm asking this question right...

I want to create the header of my page (logo and nav) on a separate document so that if I need to make a change to the text I don't have to go into each html page and do it manually. Css does this for styling, but what about the text? As is, if I want to change one word in the header I would have to go into each page and change it manually...

There has got to be a better way

2 Answers

Eric Kidwell
Eric Kidwell
12,327 Points

Shams,

You're definitely on the right track with your thinking.
To your question: No, CSS is not the best option to input or store HTML data - Although you can insert html via the "content" CSS property, it's not the best solution.

However, I recommend PHP. There's a great course on it here: http://teamtreehouse.com/library/build-a-simple-php-application

In the second section of that course, they talk about how to create Headers and Footers that will show up on all pages that point to them.

Hope that helps! Let me know if you have any other questions :D

Shams Nelson
Shams Nelson
2,888 Points

Hey thanks man, this is just what i was looking for.

~Shams