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 Use Classes in CSS

Jeff Goes
Jeff Goes
2,745 Points

I have two questions. 1) Hover over doesn't change the color 2)my "nav a" rule seems to be unnecessary

When I hover over the navigation links it just doesn't change its colors. And my "nav a" rule doesn't turn purple neither with "nav a:visited" nor without it.

here's the HTML code and the CSS code:

HTML:

<!DOCTYPE html>
<html>
  <head>
    <meta charset= "utf-8">
    <title>JeffGoes |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>Jeff Julian Goes</h1>
        <h2>Designer</h2>
      </a>
      <nav>
        <ul>
          <li><a href="index.html" class="selected">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/numbers-01.jpg">
              <img src="img/numbers-01.jpg" alt="">
              <p>Experimentation with color and texture</p>
            </a>
          </li>
          <li>
            <a href="img/numbers-02.jpg">
              <img src="img/numbers-02.jpg" alt="">
              <p>Playing with blending modes on photoshop</p>
            </a>
          </li>
          <li>
            <a href="img/numbers-06.jpg">
              <img src="img/numbers-06.jpg" alt="">
              <p>Trying to create an 80's style of glows</p>
            </a>
          </li>
          <li>
            <a href="img/numbers-09.jpg">
              <img src="img/numbers-09.jpg" alt="">
              <p>Drips created using Photoshop brushes</p>
            </a>
          </li>
          <li>
            <a href="img/numbers-12.jpg">
              <img src="/img/numbers-12.jpg" alt="">
              <p>Creating shapes using repetition</p>
            </a>
          </li>
        </ul>
      </section>
      <footer>
        <a href="https://twitter.com/goes_julian">
          <img src="img/twitter-wrap.png" alt="Twitter Logo">
        </a>
        <a href="https://www.facebook.com/jeff.goes.5">
          <img src="img/facebook-wrap.png" alt="Facebook Logo">
        </a>
        <p>&copy; 2015 Jeff Goes.</p>
      </footer>
    </div>
  </body>
</html>

CSS:

a {
  text-decoration: none;
}

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

#logo {
  text-align: center;
  margin: 20% 20%;
}

a {
  color: #6ab47b;
}

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

h1, h2{
  color: #fff;
}

nav {
  background: #599a68;
}

nav a, nav:visited{
  color: #fff;
}

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

I would really appreciate it if you help me. Thanks

Just wanted to give you a heads up that I edited your post to properly display your code snippets. If you need help posting code take a look at the Markdown Cheatsheet for reference, it's basically a matter of placing (```) before and after your code without the parenthesis. Specifying the language helps with formatting, too.

2 Answers

Alejandro Brunella
Alejandro Brunella
6,164 Points

Hey Jeff!

You are missing the "a" in:

 nav:visited{ color: #fff; } 

It should be (add "a"):

 nav a:visited{ color: #fff; }

Also, i think you meant active instead of selected (remove the space and change "." for ":" )

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

Should be :

nav a:active , nav a:hover{ color: #32673f; }

I hope this helps.

Jacobus Hindson
Jacobus Hindson
14,429 Points

Hi Jeff,

Question 1: 'nav a.selected' is an invalid class - try 'nav a:active' instead

Question 2: The posted 'nav a' rule above is set to #fff (White) change this to a #hex for purple or simply 'purple'

Hope that helps.