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

Tom Webber
Tom Webber
151 Points

None of the other answers helped me - cant apply css

Hey, Ive been learning html and css for a while now, and this lesson about applying css background and centering a div got me baffeled: I wrote the css EXACTLY as the video yet no affect on the html (still underlines the links, still floating left)

Could the problem be the workspace? providing html+css:

<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">

a { text-decoration: none; }

#wrapper { max-width: 940px; margin: 0 auto; background: orange; }

Thank you

5 Answers

You just need to remove the "background: orange;" declaration. More often than not, anything extra in a Code Challenge will cause it to fail.

Cheers!

Tom Webber
Tom Webber
151 Points

Thanks Michael but It wasn't during the code challenge, just plain coding in workspace and trying to preview it(I write while I watch)

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Tom,

Its usually a file path error when these things happen, please double check that your css file is called main.css and not Main.css
Other than that, can you post your full code for html and css.

Here is a link to explain how to use Markdown to post your code How to post code

If you look at the bottom of the box when your typing a reply you will see Markdown Cheatsheet that will also explain how to post your code.

You have to make sure you have a bit of space under your last line of text in your post. Then you add three back ticks followed by html or css depending on the type of code your inserting.
Then straight after your last line of code you add another three back ticks.
Remember to leave at least a few lines between any text at the top or bottom of your code.

alt text

Hope this helps.

Tom Webber
Tom Webber
151 Points

The file names are just right...Here it is:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Tom Webber | 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>Tom Webber</h1>
        <h2>Web designer</h2>
      </a>
      <nav>
        <ul>
          <li><a href="index.html">Portfolio</a>
          </li>
          <li><a href="about.html">About</a></li>
          <li><a href="contact.html">Contact</a>
          </li>
        </ul>
      </nav>
    </header>
    <div id="wrapper">
      <section>
        <ul>
          <li>
            <a href="img/failure.jpg">
              <img src="img/failure.jpg" alt="">
              <p>System failure</p>
            </a>
          </li>
          <li>
            <a href="img/cobweb.jpg">
              <img src="img/cobweb.jpg" alt="">
              <p>The matrix</p>
            </a>
          </li>
          <li>
            <a href="img/matrix2.jpg">
              <img src="img/matrix2.jpg" alt="">
              <p>Cool matrix</p>
            </a>
          </li>
          <li>
            <a href="img/cobweb-001.jpg">
              <img src="img/cobweb-001.jpg" alt="">
              <p>Experiment</p>
            </a>
          </li>
        </ul>
      </section>
      <footer>
        <a href="http://www.facebook.com/pages/WebberTom/1030444520316045"><img src="img/facebook-wrap.png" alt="facebook"/></a>
        <a href="http://twitter.com/WebbrTom"><img src="img/twitter-wrap.png" alt="twitter"/></a>
        <p>&copy; 2015 Tom Webber</p>
      </footer>
    </div>
  </body>
</html>

css :

a {
  text-decoration: none;
}

#wrapper {
  max-width: 940px;
  margin: 0 auto;
  background: orange;
}
Wayne Priestley
Wayne Priestley
19,579 Points

Hi Tom,

I entered your code in codepen and everything appears as its supposed to according to your css.
Links are not underlined and wrapper is centred.

Deneen Edwards
Deneen Edwards
5,626 Points

Trying clearing your cache to make sure you're seeing the latest version of r website.