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 How to Make a Website CSS: Cascading Style Sheets Take a Mobile-First Approach

Nikhil Khandelwal
Nikhil Khandelwal
9,371 Points

Heading is not centered in CSS and code for body background color not working

I have made the div tag and heading anchor "logo", but when I write h1 {... text align center} it works, but not with

logo. Why

  1. I want to change the back ground color, padding , margins, but none of them are working?

Please help

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Nikhil Khandelwal |Designer </title> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/main.css">

</head>
<body>
    <header>
        <a href="index.html" id:"logo">
          <h1>Nikhil</h1>
          <h2>Designer</h2>
        </a> 
      <nav>
        <ul>
          <li><a href="index.html">Portfolio</a></li>
          <li><a href="about us.html">About Us</a></li>
          <li><a href="contact.html">Contact</a></li>
        </ul>
      </nav>
    </header>
  <div id:"wrapper">
    <section>
      <ul>
        <li><a href="img/numbers-01.jpg"><img src="img/numbers-01.jpg" alt=""></a></li>
        <li><a href="img/numbers-02.jpg"><img src="img/numbers-02.jpg" alt=""></a></li>
        <li><a href="img/numbers-06.jpg"><img src="img/numbers-06.jpg" alt=""></a></li>
      </ul>
      <p>This is a paragraph.</p>
    </section>
    <footer>
      <a href="http://facebook.com"><img src="img/facebook-wrap.png"></a>
      <a href="http://twitter.com"><img src="img/twitter-wrap.png"></a>
      <p>&copy; 2015 All Rights Reserved</p>
    </footer>
  </div>
</body>

</html>

2 Answers

Hey you're writing

id:"logo"

you should be using an equals sign instead of a colon. like this.

id = "logo"

Also when selecting an id in your css make sure you're using this syntax

#logo {
  your styling goes here;
}
Nikhil Khandelwal
Nikhil Khandelwal
9,371 Points

Yup.. it worked now..:)

Thank you

jamesscott
jamesscott
4,432 Points

It's the subtle stuff that always gets me!

= vs. :

Thanks for the help, Pete!!!

-jS