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 Styling Web Pages and Navigation Style the Portfolio

Why is my css selector highlighted red?

Why are the css selectors in my workspace are highlighted red?

Stone Preston
Stone Preston
42,016 Points

can you post your code

5 Answers

Stone Preston
Stone Preston
42,016 Points

you have an opening brace instead of a closing one after the img selector:

img {
  max-width: 100%
    { /*this needs to be a closing brace */

fix that

img {
  max-width: 100%
    }
Kelly von Borstel
Kelly von Borstel
28,878 Points

It might be a syntax error. For example, if you're missing a curly brace at the end of declaration block, the selectors after that missing brace would be highlighted red.

The #logo, h1, and h2, are highlighted red. Since this appeared my styling has disappeared when I preview through workspace.

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

h1 {
  font-family: 'Vollkorn', serif;
  margin: 15px 0;
  font-size: 1.75em;
  font-weight: normal;
  line-height: 0.8em;
}

h2 {
  font-size: 0.75em;
  margin: -5px 0 0;
  font-weight: normal;
}
Kelly von Borstel
Kelly von Borstel
28,878 Points

Do you have other rules in your css? If so, could you post all css?

This is everything.

/**************
GENERAL
**************/

body {
font-family: 'Cuprum': sans-serif;
}

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

a {
  text-decoration: none;
}

img {
  max-width: 100%
    {

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

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

h1 {
  font-family: 'Vollkorn', serif;
  margin: 15px 0;
  font-size: 1.75em;
  font-weight: normal;
  line-height: 0.8em;
}

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

/**************
NAVIGATION
**************/

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



/**************
FOOTER
**************/

footer {
  font-size: 0.75em;
  text-align: center;
  padding-top; 50px;
  color: #ccc;
}



/**************
Page: Portfolio
**************/

      #gallery {
        margin: 0;
        padding: 0;
        list-style: none;
      }

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

/**************
Colors
**************/


/* site body */
body {
  background-color: #fff;
  color:#999;
}

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

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

/* LOGO TEXT */
h1, h2 {
  color: #fff;
}

/* link */
a{
 color: #6ab47b;
}

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

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

Thank you! That definitely fixed it.

Kelly von Borstel
Kelly von Borstel
28,878 Points

At the end of img {max-width: 100%, and right before the comment line for HEADING you mistyped an opening curly brace instead of a closing curly brace.

Kelly von Borstel
Kelly von Borstel
28,878 Points

Sorry, didn't see that Stone already answered.