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 trialMary Sutherland
688 PointsWhy is my css selector highlighted red?
Why are the css selectors in my workspace are highlighted red?
5 Answers
Stone Preston
42,016 Pointsyou 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
28,880 PointsIt 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.
Mary Sutherland
688 PointsThe #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
28,880 PointsDo you have other rules in your css? If so, could you post all css?
Mary Sutherland
688 PointsThis 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;
}
Mary Sutherland
688 PointsThank you! That definitely fixed it.
Stone Preston
42,016 Pointsno problem
Kelly von Borstel
28,880 PointsAt 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
28,880 PointsSorry, didn't see that Stone already answered.
Stone Preston
42,016 PointsStone Preston
42,016 Pointscan you post your code