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

HTML SVG Basics SVG and CSS Responsive SVGs

Johannes Svensson
Johannes Svensson
4,128 Points

SVG doesn't change when made bigger or smaller

My SVG doesn't change at all after doing all the coding and I can't find anything wrong with it. Please help! I use Atom as my Editor if that has something to do with it.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Scalable Vector Graphics</title>
    <link rel="stylesheet" href="css/normalize.css">
    <link rel="stylesheet" href="css/main.css">
  </head>
  <body>

    <h1>SVG Example</h1>

    <div class="wrapper">

        <svg class="graphic" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 360" enable-background="new 0 0 360 360">
          <path fill="#8361B4" d="M0 0h360v360h-360z"/>
          <circle class="outer-circle" fill="#FDE135" stroke="#fff" stroke-width="8" stroke-miterlimit="10" cx="180" cy="180" r="157"/>
          <circle class="inner-circle" fill="#CAA61F" stroke="#fff" stroke-width="8" stroke-miterlimit="10" cx="180" cy="180" r="108.3"/>
          <path class="outer-circle" d="M89.4 276.7c-26-24.2-42.2-58.8-42.2-97.1 0-22.6 5.6-43.8 15.5-62.4m234.7.1c9.9 18.6 15.4 39.7 15.4 62.2 0 38.3-16.2 72.8-42.1 97" stroke="#CAA61F" stroke-width="8" stroke-linecap="round" stroke-miterlimit="10" fill="none"/>
          <path class="star" fill="#FDE135" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="M180 107.8l16.9 52.1h54.8l-44.3 32.2 16.9 52.1-44.3-32.2-44.3 32.2 16.9-52.1-44.3-32.2h54.8z"/>
          <circle class="star-point" fill="#CAA61F" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="180" cy="107.8" r="4.4"/>
          <circle class="star-point" fill="#CAA61F" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="223.7" cy="244.2" r="4.4"/>
          <circle class="star-point" fill="#CAA61F" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="135.5" cy="244.2" r="4.4"/>
          <circle class="star-point" fill="#CAA61F" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="108.3" cy="160.4" r="4.4"/>
          <circle class="star-point" fill="#CAA61F" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="251.7" cy="160.4" r="4.4"/>
          <circle class="star-point" fill="#CAA61F" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="197.4" cy="159.4" r="4.4"/>
          <circle class="star-point" fill="#CAA61F" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="163" cy="159.4" r="4.4"/>
          <circle class="star-point" fill="#CAA61F" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="152" cy="192.5" r="4.4"/>
          <circle class="star-point" fill="#CAA61F" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="208" cy="192.5" r="4.4"/>
          <circle class="star-point" fill="#CAA61F" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="180" cy="213.2" r="4.4"/></svg>


    </div>

  </body>
</html>
*, *:before, *:after {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  font-family: 'Nunito', sans-serif;
  color: #384047;
}

.wrapper {
  max-width: 90%;
  margin: 10px auto;
  padding: 10px 20px;
  background: #f4f7f8;
  border-radius: 8px;
}

h1, h2 {
  margin: 30px 0;
  text-align: center;
}

.graphic {
  margin: 1em auto;;
  width: 30%;
  display: block;
}

.star-point,
.outer-circle {
  opacity: 0;
}

.inner-circle {
  stroke-opacity: 0;
}

.star {
  stroke-width: 8;
}

@@media only screen and (min-width: 30em) {
  .inner-circle {
    stroke-opacity: 1;
  }
}

@@media only screen and (min-width: 40em) {
  .outer-circle {
    opacity: 1;
  }

  .star {
    stroke-width: 4;
  }

}

@@media only screen and (min-width: 64em) {
  .star-point {
    opacity: 1;
  }
}

1 Answer

You have @@media instead of just @media in your media queries. I downloaded the project files and there is also a difference in your index.html but I can't figure that one out.

Johannes Svensson
Johannes Svensson
4,128 Points

Thank you so much, it works for me now. Not sure about the index difference you are talking about tho. I also don't use Workspaces but I use Atom. But feel free to tell me if you find out what's wrong