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 Sass Basics Improve Your Workflow with Sass Use the Ampersand to Reference Parent Selectors

Sean Flanagan
Sean Flanagan
33,235 Points

Button text colour doesn't change

Hi.

I watched the video up to 5 minutes 24 seconds. The button text colour won't change.

My index.html:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Experience VR</title>
    <link href="https://fonts.googleapis.com/css?family=Bree+Serif|Raleway" rel="stylesheet">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons"
      rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
  </head>
  <body>
    <header>
      <div class="inner">
        <ul class="main-nav">
          <li><a href="#">About</a></li>
          <li><a href="#">Resources</a></li>
          <li><a href="#">Contact</a></li>                
        </ul>
        <h1>Experience VR</h1>
        <p>A simple blog about virtual reality experiences</p>
        <img class="img-featured" src="img/featured.jpg" alt="VR headset">
      </div>
    </header>

    <div class="intro">
      <p> Virtual Reality is becoming well known as a form of entertainment, but it's also finding its way into fields like architecture, industrial design, healthcare, and so much more!</p>
      <a class="btn btn-callout" href="https://teamtreehouse.com/vr">Start Your VR Journey</a>
    </div>

    <div class="main-content">
      <div class="card">
        <i class="material-icons icon">videocam</i>
        <h1>Entertainment</h1>
        <p>Hundreds of VR games and films have been released already. <a href="#">Oculus Story Studio</a> is one example of a company producing VR films.</p>
        <a class="btn btn-info" href="#">Learn more</a>
      </div>
      <div class="card">
        <i class="material-icons icon">account_balance</i>
        <h1>Architectural Visualization</h1>
        <p>These experiences allow you to explore and interact with buildings and products in virtual reality. <a href="#">IKEA VR</a> is a popular example.</p>
        <a class="btn btn-info" href="#">Learn more</a>        
      </div>
      <div class="card"> 
        <i class="material-icons icon">school</i>
        <h1>Education</h1>
        <p>VR allows students to visit other places and other times. For instance, the BBC produced a <a href="#">360° video</a> that allows users to see the scale of dinosaurs in stereoscopic 3D.</p>
        <a class="btn btn-info" href="#">Learn more</a>        
      </div> 
      <div class="card">
        <i class="material-icons icon">flight_takeoff</i>
        <h1>Simulation &amp; Training </h1>
        <p>In simulation and training, you can safely train for dangerous situations or hazardous environments.</p>
        <a class="btn btn-info" href="#">Learn more</a>
      </div>
      <div class="card">
        <i class="material-icons icon">people</i>
        <h1>Social Networking</h1>
        <p>VR is finding its way into teleconferencing and social media. At the <a href="#">ethic conference in 2016</a>, Facebook demonstrated what it might look like in VR.</p>
        <a class="btn btn-info" href="#">Learn more</a>        
      </div>
      <div class="card"> 
        <i class="material-icons icon">videogame_asset</i>
        <h1>Games</h1>
        <p>VR games let users experience a 3D environment, creating suspension of disbelief, which makes users experience the environment as real.</p>
        <a class="btn btn-info" href="#">Learn more</a>        
      </div>                
    </div>

    <footer>
      <span>&copy;2017 Experience VR, The Blog</span>
    </footer>
  </body>
</html>

My style.scss:

// VARIABLES ------------------------------------ /

$white: #fff;

$color-primary: #278da4;
$color-secondary: #b13c69;
$color-accent: #eeea72;
$color-shade: #eee;

$color-text: #343434;
$color-bg: #3acec2;
$color-bg-light: #009fe1;

$font-stack-primary: 'Raleway', sans-serif;
$font-stack-secondary: 'Bree Serif', serif;

/* BASE ------------------------------------------- */

* {
  box-sizing: border-box;
}

body {
  color: $color-text;
  font-size: 1rem;
  line-height: 1.5;
  font-family: $font-stack-primary;
  text-align: center;
  margin: 0;
}

h1,
h2 {
  font-family: $font-stack-secondary;
}

ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

p {
  margin-bottom: 1.25em;
  .intro & {
    font-size: 1.2em;
  }
}

a {
  color: $color-primary;
  text-decoration: none;
  :hover {
      color: $color-secondary;
  }
}

/* HEADER & FOOTER -------------------------------- */

header {
  height: 460px;
  background: linear-gradient($color-bg-light, $color-bg), url('../img/bg.jpg') no-repeat;
  background-blend-mode: multiply;
  background-size: cover;
  position: relative;
  h1 {
    color: $white;
    font-size: 4.8em;
    margin-bottom: 0;
    letter-spacing: 1px;
  }
  p {
    color: $color-accent;
    font-size: 1.25em;
    margin: 0;
  }
  &::after {
    content: '';
    display: block;
    width: 100%;
    height: 50px; 
    position: absolute;
    transform: skewY(-2deg);
    background-color: $white;
    bottom: -25px;
  }
}

footer {
  padding: 2em 0 0;
  height: 100px;
  background-color: $color-shade;
  margin-top: 3.5em;
  position: relative;
  &::before {
    content: '';
    display: block;
    width: 100%;
    height: 50px; 
    position: absolute;
    transform: skewY(-2deg);
    background-color: $color-shade;
    top: -25px;
  }
}

/* CONTAINERS ------------------------------------- */

.inner {
  padding: 0.5em 1em;
}

.intro {
  margin: auto;
  padding: 1em 1em 3em; 
}

/* COMPONENTS ------------------------------------- */

.main-nav {
  margin-top: 1em;
  li {
    display: inline-block;
    margin: 0 0.65em;
  }
  a {
    color: $white;
    font-size: 0.85em;
    text-decoration: none;
    text-transform: uppercase;
    padding: 0.5em;
  }
}

.img-featured {
  width: 165px;
  border: 4px solid $white; 
  border-radius: 50%;
  margin-top: 75px;
  position: relative;
  z-index: 100;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 1.5em 1em;
  border: 1px solid $color-shade;
  border-radius: 0.25em;
  h1 {
    margin: 0.35em 0 0;
    line-height: 1.25;
  }
  .icon,
  h1 {
    color: $color-primary;
  }
}

.btn {
  color: $white;
  display: inline-block;
  font-weight: bold;
  text-decoration: none;
  text-transform: uppercase;
  padding: 0.75em 1.5em;
  border-radius: 0.35em;
  &-callout {
    font-size: 1.1em;
    background-color: $color-secondary;
  }
  &-info {
    font-size: 0.85em;
    background-color: $color-primary;  
    margin-top: auto;
  }
}


/* MEDIA QUERIES ---------------------------------- */

@media (max-width: 575px) {
  header {
    height: 340px;
  }
  header h1 {
    font-size: 3.4em;
  }
  .img-featured {
    display: none;
  }
}

@media (min-width: 576px) {
  .main-content {
    display: flex;
    flex-wrap: wrap;
  }  
  .card {
    flex: 1;
  }
}

@media (min-width: 768px) {
  .main-content {
    width: 90%;
    max-width: 1000px;
    margin: 0 auto;
  }
}

@media (min-width: 992px) {
  header {
    background-position: 0 0, 0 45%;
  }
  .intro {
    width: 45%;
  }
}

And my style:css output file:

/* BASE ------------------------------------------- */
* {
  box-sizing: border-box; }

body {
  color: #343434;
  font-size: 1rem;
  line-height: 1.5;
  font-family: "Raleway", sans-serif;
  text-align: center;
  margin: 0; }

h1,
h2 {
  font-family: "Bree Serif", serif; }

ul {
  list-style-type: none;
  padding: 0;
  margin: 0; }

p {
  margin-bottom: 1.25em; }
  .intro p {
    font-size: 1.2em; }

a {
  color: #278da4;
  text-decoration: none; }
  a :hover {
    color: #b13c69; }

/* HEADER & FOOTER -------------------------------- */
header {
  height: 460px;
  background: linear-gradient(#009fe1, #3acec2), url("../img/bg.jpg") no-repeat;
  background-blend-mode: multiply;
  background-size: cover;
  position: relative; }
  header h1 {
    color: #fff;
    font-size: 4.8em;
    margin-bottom: 0;
    letter-spacing: 1px; }
  header p {
    color: #eeea72;
    font-size: 1.25em;
    margin: 0; }
  header::after {
    content: '';
    display: block;
    width: 100%;
    height: 50px;
    position: absolute;
    transform: skewY(-2deg);
    background-color: #fff;
    bottom: -25px; }

footer {
  padding: 2em 0 0;
  height: 100px;
  background-color: #eee;
  margin-top: 3.5em;
  position: relative; }
  footer::before {
    content: '';
    display: block;
    width: 100%;
    height: 50px;
    position: absolute;
    transform: skewY(-2deg);
    background-color: #eee;
    top: -25px; }

/* CONTAINERS ------------------------------------- */
.inner {
  padding: 0.5em 1em; }

.intro {
  margin: auto;
  padding: 1em 1em 3em; }

/* COMPONENTS ------------------------------------- */
.main-nav {
  margin-top: 1em; }
  .main-nav li {
    display: inline-block;
    margin: 0 0.65em; }
  .main-nav a {
    color: #fff;
    font-size: 0.85em;
    text-decoration: none;
    text-transform: uppercase;
    padding: 0.5em; }

.img-featured {
  width: 165px;
  border: 4px solid #fff;
  border-radius: 50%;
  margin-top: 75px;
  position: relative;
  z-index: 100; }

.card {
  display: flex;
  flex-direction: column;
  padding: 1.5em 1em;
  border: 1px solid #eee;
  border-radius: 0.25em; }
  .card h1 {
    margin: 0.35em 0 0;
    line-height: 1.25; }
  .card .icon,
  .card h1 {
    color: #278da4; }

.btn {
  color: #fff;
  display: inline-block;
  font-weight: bold;
  text-decoration: none;
  text-transform: uppercase;
  padding: 0.75em 1.5em;
  border-radius: 0.35em; }
  .btn-callout {
    font-size: 1.1em;
    background-color: #b13c69; }
  .btn-info {
    font-size: 0.85em;
    background-color: #278da4;
    margin-top: auto; }

/* MEDIA QUERIES ---------------------------------- */
@media (max-width: 575px) {
  header {
    height: 340px; }

  header h1 {
    font-size: 3.4em; }

  .img-featured {
    display: none; } }
@media (min-width: 576px) {
  .main-content {
    display: flex;
    flex-wrap: wrap; }

  .card {
    flex: 1; } }
@media (min-width: 768px) {
  .main-content {
    width: 90%;
    max-width: 1000px;
    margin: 0 auto; } }
@media (min-width: 992px) {
  header {
    background-position: 0 0, 0 45%; }

  .intro {
    width: 45%; } }

/*# sourceMappingURL=style.css.map */

How do I fix this please?

Thanks

Sean

3 Answers

gene c
gene c
13,630 Points

your .btn class has the property "color: $white"

remove the $

Max Weir
Max Weir
14,963 Points

What colour is the text on all buttons?

Sean Flanagan
Sean Flanagan
33,235 Points

Hi guys. Sorry for the holdup. I hope you've had a happy Christmas.

The colour problem has been fixed.

This is what my workspace looks like now:

https://w.trhou.se/7vjjg8kf58

When I preview the page, only one image and the HTML show. The console says there's an error in my header.scss but I don't know how to fix it. What should I do?

I've given both replies an upvote as a gesture of my appreciation.

Thanks in advance.

Sean