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 CSS Basics (2014) Enhancing the Design With CSS Media Queries

@media query font size

Can someone assist me with this question .. I believe that I have it right but it's wont take what I put in. Thanks!

style.css
/* Complete the challenge by writing CSS below */
@media (max-width: 1020px) {
  .main-header {
    background: tomato;
    color: white;
  }
}

@media (max-width: 768px) {
  .title: {
    font-size: 1.4rem;
  } 
  h1 {
    font-size: 5rem;
  }
}
index.html
<!DOCTYPE html>
<html>
  <head>
    <title>Lake Tahoe</title>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
  </head>
  <body> 
    <header id="top" class="main-header">
      <span class="title">Journey Through the Sierra Nevada Mountains</span>
      <h1 class="main-heading">Lake Tahoe, California</h1>
    </header>

        <div class="primary-content">
            <p class="intro">
                Lake Tahoe is one of the most breathtaking attractions located in California. It's home to a number of ski resorts, summer outdoor recreation, and tourist attractions. Snow and skiing are a significant part of the area's reputation.
            </p>
            <a class="callout" href="#more">Find out more</a>
        </div><!-- End .primary-content -->
  </body>
</html>

5 Answers

Daniel Barros
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Daniel Barros
Front End Web Development Techdegree Graduate 23,589 Points

Hi William,

I tried the exact same code you reproduced in your question and got a pass in the challenge. I also tested both your files in Codepen and the media queries work as expected.

You may find an issue with the challenge window viewer though, as it's relatively small and it seems it will not reach the minimum 768px for the narrower media query to kick in.

I hope this info is of assistance. :)

Just send a reply if you're still having issues with it and I'm happy to assist. Cheers,

Daniel

You have a colon after .title that shouldn't be there

im not passing either. my code:

  ```css
      /* Complete the challenge by writing CSS below */

@media (max-width: 1020px) { .main-header { background-color: tomato; color: white; }

@media (max-width: 768px) { .title { font-size: 1.4rem; } h1 { font-size: 5rem; } } ```

Rachel Campbell
Rachel Campbell
12,958 Points

I'm having the same issue (without the colon after .title)..

@media (max-width: 1020px) { .main-header { background-color: tomato; color: white; } @media (max-width: 768px) { .title { font-size: 1.4rem; } h1 { font-size: 5rem; } } }

keeps telling me I didn't set the correct font size for .title but the instructions do say 1.4 rem

Rachel - You are missing a closing bracket for your first media query.

Rachel Campbell
Rachel Campbell
12,958 Points

Ah, thank you so much Kris! I was so frustrated trying to figure out what was going on in the second section that I completely overlooked that. /facepalm. Thank you!