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

Centering Header and * {} function

site: sunnysihota.com

The header isn't centered. The problem is when I use the * {} function I get it centered but I can't change the text color of my titles to anything else since the * {} function overrides all text color. So I got rid of the * {} function and used the code below but then the header isn't centering or changing to the right color

code:

header {
font-family: Arial, Verdana, sans-serif;
color: #665544;
text-align: center;

}

body { background-color:#F0EFE9; }

nav, #footer {

background-color: #A67829;
margin-top: 20px;
padding: 10px 0px 5px 0px;
font-family: Arial, Verdana, sans-serif;
color: #665544;
text-align: center;

}

.images { margin-top: 20px; padding: 10px 0px 5px 0px; }

.names { line-height: 0.75em; color: #4C607A; text-align: center; font-family: Arial; }

.article { height:250px; font-family: Arial, Verdana, sans-serif; color: #665544; text-align: center; }

li { display: inline; padding: 5px; }

1 Answer

Hi Rajinder,

You forgot the id selector:

#header {font-family: Arial, Verdana, sans-serif; color: #665544; text-align: center;}

Or, if you're planning to use HTML5 semantic elements, you'll need to specify this in your HTML file. Right now you're doing one concept in your CSS and the other in your HTML.

thanks for the help