Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS How to Make a Website Customizing Colors and Fonts Organize CSS with Comments

My header doesn't show anymore as centred after organising main.css+putting comments.

After following steps from video and reorganising elements inside main.css the header does not show up in the middle as centred. I have a feeling something is overriding it, because when I move #logo {...} to the bottom of main.css seems to work.

Can you help me?

Thanks.

8 Answers

Do you have an open caret anywhere? Additionally CSS has a cascading effect, hence the name. So if are utilizing multiple attributes to the same item\class then the last one run, will work. It's hard to tell exactly what is happening without seeing the code for reference.

Hi David,

I've checked both my main.css and index.html but I didn't see any open carets.

This is the way it's written:

/*********************************************** HEADING ***********************************************/

logo {

text-align: center; margin: 0; }

h1 { font-family: 'Raleway', sans-serif; margin: 15px 0; font-size: 1.75em; font-weight: normal; line-height: 0.8em }

h2 { font-size:: 0.75em; margin: -5px 0 0; font-weight: normal; }

Sorry but hashtag before word logo didn't show up but there's one.

You're missing a semi-colon at the end of the line-height declaration for h1.

Thanks, I corrected it. But the problem with center text still exists.

This is the css itself:

/*********************************************** GENERAL ***********************************************/

boyd { font-family: 'Arimo', sans-serif; }

wrapper {

max-width: 940px; margin: 0 auto; padding: 0 5%; }

a { text-decoration: none; }

/*********************************************** HEADING ***********************************************/

logo {

text-align: center; margin: 0; }

h1 { font-family: 'Raleway', sans-serif; margin: 15px 0; font-size: 1.75em; font-weight: normal; line-height: 0.8em; }

h2 { font-size: 0.75em; margin: -5px 0 0; font-weight: normal; }

/*********************************************** NAVIGATION ***********************************************/

nav { text-align: center; padding: 10px 0; margin: 20px 0 0; }

/*********************************************** FOOTER ***********************************************/

footer { font-size:0.75em; text-align: center; padding-top: 50px; color: #ccc; }

/*********************************************** COLOR ***********************************************/

/* site body */ body { background-color: #fff; color: #999 }

/* red header */ header { background: #993333; border-color: #FFDB4D; }

/* nav background on mobile */ nav { background: #6B2424; }

/* logo text */ h1, h2 { color: #fff; }

/* links */ a { color: #993333; }

/* nav link */ nav a, nav a:visited { color: #fff; }

/* selected nav link */ nav a.selected, nav a:hover { color: #895050; }

header{ margin: 0 auto; text-align: center; }

Will center the header inside of it's container (presuming .wrapper) and center the text in the header (inheritance)

/*********************************************** GENERAL ***********************************************/

body { font-family: 'Arimo', sans-serif; background-color: #fff; color: #999; }

wrapper {

max-width: 940px;
margin: 0 auto;
padding: 0 5%;

}

a { text-decoration: none; color: #993333; }

/*********************************************** HEADING ***********************************************/

logo {

text-align: center;
margin: 0;

}

h1 { font-family: 'Raleway', sans-serif; margin: 15px 0; font-size: 1.75em; font-weight: normal; line-height: 0.8em; }

h2 { font-size: 0.75em; margin: -5px 0 0; font-weight: normal; }

/*********************************************** NAVIGATION ***********************************************/

nav { text-align: center; padding: 10px 0; margin: 20px 0 0; }

/*********************************************** FOOTER ***********************************************/

footer { font-size:0.75em; text-align: center; padding-top: 50px; color: #ccc; }

/*********************************************** COLOR **********************************************/ / red header */ header { margin: 0 auto; text-align: center; background: #993333; border-color: #FFDB4D; }

/* nav background on mobile */ nav { background: #6B2424; }

/* logo text / h1, h2 { color: #fff; } / nav link */ nav a, nav a:visited { color: #fff; }

/* selected nav link */ nav a.selected, nav a:hover { color: #895050; }

Fixed! Thank you David. I'm really enjoying learning html and css but it can be tricky at times!

Yes it can, 90% of the problems I've ever had, have been mis-types, not mis-logic, keep that in mind and you'll be fine.