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 is it that in the first page the header background color is allright and in the other pges is not?

if the main css is the same in all of them. maybe its a problom in the html, in the .selected maybe.... but how? is somone can send me his\hers site code? all of it?

thank you vary much!

Edited question due to personal info.

Noga, I deleted your email address on this post, due to it being personal information. People should only be able to reach you via this forum, and I personally feel that having your email address posted here might not be the best idea.

The way the forum works is that there is a post an answer section that people can post answers to your question. You will still get a notification that someone has posted on this forum. In the future please be carful about posting personal information like email and phone numbers. Not everyone is nice.

please post your code of the HTML and the CSS of the header class. What might be going on is that in other page you might not have the same class name for your header and that is the issue.

7 Answers

yes, thank you very much!

Awesome

Hello Noga,

Have you made sure that you have correctly written a link to your CSS in a HTML document. When writing a link make sure that you have got the correct file path to the relevant folder.

Please include your source code so that I could review the issue.

If you could show us code would be great but if your css is targeting your .selected class make sure you change said class from your index.html to about.html and contact.html.

<a href="about.html" class="selected">About</a>

<a href="contact.html" class="selected">Contact</a>

Edit: make sure you apply the selected class only to the corresponding page and not all the pages.

Happy coding.

this is just some examples from my code....

 <header>
      <a href="index.html" id="logo">
        <h1>Eden Halili</h1>
        <h2>Model</h2>
      </a>
      <nav>
        <ul id="menu">
          <li><a href="index.html">Portfolio</a></li>
          <li><a href="about.html">About</a></li>
          <li><a href="contact.html" class="selected">Contact</a></li>
        </ul>
      </nav>
    </header>
header {
  float: left;
  background-color: #ffcc99;
  margin: -15px 20px 20px -20px;
  padding: 1%;
  width: 100%;
}

a {
  font-weight: normal;
  font-size: 1.2em;
  text-decoration: none;
  color: #fff;
  font-family: 'Poiret One', cursive;
}

/**********************
navigationt
***********************/

nav a:hover {
  color: #000;
}

.selected {
color: #000;  
}

nav {
  background-color: #ffb366;
  text-align: center;
  padding: 0 0 15px 0;
  margin: -15px;
}

nav a {
  padding: 0;
  margin: 10px;
}

#menu {
 margin: 10px 20px -10px 0; 
}

ul {
  list-style-type: none;
}

nav li {
  display: inline-block;
}

I really dont know whats wrong with it... The header disappeared and the header backgound color.

This code works on [codepen](codepen.io), Is what is happening when you click on another page the style doesn't work? if thats the case, I would look at the head tag on the page that is having an issue, and make sure you are linking the style page to that page. Also make sure your id's and class names are exactly the same as in the CSS.

Hello Noga,

Looking at your code there seems to be no problems. However I believe that the issue you are experiencing could be because of how you have structured your documents. To resolve this change the value of 'href' within the link tag in the HTML document that does not change the colour of the heading to the correct file path.

thank you guys! you helped me a lot!

did you get your issue fixed?

yes, thank you very much:)