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 Build a Website", trouble getting the nav a to work in CSS

Hi! Everything up until now matches the tutorial, but when I typed in

nav a {
  font-weight:800;
  padding: 15px 10px;
}

it's not rendering like it's supposed to. Any help would be greatly appreciated! Thanks.

Here is my CSS:

/**************
GERNERAL 
**************/

body {
  font-family: 'Open Sans', sans-serif; 
}

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

a {
 text-decoration:none; 
}

img {
  max-width: 100%; 
}

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

/*controling the pixels goes top, right, bottom, left
-Setting our margins keeps the header separated from other content at least on the bottom. But removes the problematic margins that we had on the top, previously.
-Adding padding on top will seperate the text without actually removing the margin from the top of the page. 
-It's now a floated element which means it doesn't have an explicit width anymore. We want to specifically say that this element should stretch across the entire page so we've set a width of 100%.
*/
header {
  float: left;
  margin: 0 0 30px 0; 
  padding: 5px 0 0 0;
  width: 100%;
}

#logo {
  text-align: center; 
  margin: 0;
}

h1 {
 font-family: 'Changa One', sans-serif; 
  font-family: 15px 0; 
  font-size: 1.75em; 
}

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


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

nav ul {
  list-style: none; 
  margin: 0 10px;
  padding: 0;
}

nav li {
display: inline-block; 
}

nav a {
  font-weight:800;
  padding: 15px 10px;
}
/**************
FOOTER
**************/
 footer { 
  font-size: 0.75em;
  text-align: center;
  clear:both; 
  padding-top: 50px;
  color: #ccc;
}

.social-icon {
  width: 20px;
  height: 20px;
  margin: 0 5px;
}



/**************
PAGE: PORTFOLIO   
**************/
#gallery {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* the width of the pictures are at a max of 45% of the browser, no matter the size of the browser window. So it works with mobile. Since 45 and 45 is 90, we have a remainder of 10 to use for margins. 2.5% on each side of the two pictures. */

#gallery li {
  float: left;
  width: 45%;
  margin: 2.5%;
  background-color: #f5f5f5;
  color: #bdc3c7;
}

#gallery li a p {
  margin: 0;
  padding: 5%;
  font-size: 0.75em;
  color: #bdc3c7;
}
/**************
COLORS  
**************/

/* site body THIS IS A COMMENT*/
body {
  background-color: #fff;
  color: #999;
}

/* green header */
header {
  background:#6ab47b;
  border-color: #599a68;
}

/* nav background on mobile */ 
nav {
  background: #599a68;
}

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

a {
 color: #6ab47b; 
}

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

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

Here is my html:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Carah Burrell | Awesome Person</title>
    <link rel="stylesheet" href="css/normalize.css">
    <link href='http://fonts.googleapis.com/css?family=Changa+One|Open+Sans:400italic,700italic,400,700,800' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/main.css">
  </head>
  <body>
    <header>
      <a href="index.html" id="logo">
      <h1>Carah Burrell</h1>
        </a>
      <a href="index.html" id="logo">
      <h2>Awesome Girl</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 id="gallery">
        <li>
          <a href="img/numbers-o1.jpg"></a>
            <img src="img/numbers-01.jpg" alt="">
            <p>Whoa look at this color and texture crap!</p>
        <a/>
        </li>
         <li>
          <a href="img/numbers-o2.jpg"></a>
            <img src="img/numbers-02.jpg" alt="">
            <p>Blend some colors with me!</p>
        <a/>
        </li>
         <li>
          <a href="img/numbers-o6.jpg"></a>
            <img src="img/numbers-06.jpg" alt="">
            <p>Where my 80s babies at?!</p>
        <a/>
        </li> <li>
          <a href="img/numbers-o9.jpg"></a>
            <img src="img/numbers-09.jpg" alt="">
            <p>Photoshop ruuuulz</p>
        <a/>
        </li> <li>
          <a href="img/numbers-12.jpg"></a>
            <img src="img/numbers-12.jpg" alt="">
            <p>Yeah! Stripes!</p>
        <a/>
        </li>
          </ul>
            </section>
              <footer>
                <a href="http://twitter.com/carahrulez">
                <img src="img/twitter-wrap.png" alt="Twitter Logo" class="social-icon"></a>
                <a href="http://facebook.com/carahburrell">
                <img src="img/facebook-wrap.png" alt="Facebook Logo" class="social-icon"></a>
      <p>&copy; 2014 Carah Burrell.</p>
      </footer>
      </div>
  </body>
</html>

2 Answers

What's not rendering correctly?

In your gallery markup you have an extra closing </a> and also an incorrect one <a/>

this:

<a href="img/numbers-o1.jpg"></a>
            <img src="img/numbers-01.jpg" alt="">
            <p>Whoa look at this color and texture crap!</p>
        <a/>

Should be this:

<a href="img/numbers-o1.jpg">
            <img src="img/numbers-01.jpg" alt="">
            <p>Whoa look at this color and texture crap!</p>
</a>

Also, it looks like the filename in the href might be using a lowercase o rather than the digit zero.

Ah, so simple! Thanks so much!