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

Font size for h1 class.

It keeps asking for the correct font size for the h1 class at the very end, I dont know what am doing wrong.

style.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;
  }
}
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>

2 Answers

Cameron Childres
Cameron Childres
11,817 Points

You're very close! Remember that "title" is a class, you select it with the period before like ".title.". When you put a period before a selector you're saying that you want your properties to be applied to classes specifically.

h1 is an HTML element, which does not use a period. You target it simply with "h1" on its own. Remove the leading period and your styles should apply appropriately. Hope this helps :)

Cameron's answer is correct, but I wanted to add a little more explanation to help you understand what he's talking about.

Basically, the term you're looking for (and the one you should google if you'd like more information) is "CSS Selectors."

When you're writing CSS, you are basically applying your styles to a target selector such as an element, a class, or an id.

For example, if I wanted to write some CSS to target every h1 element on my website, my CSS file would include a section for the h1 element, as so:

h1 {
  font-size: 52;
}

On the other hand, if I wanted to target a class I applied to multiple h1 sections around my website ("<h1 class="myclass"></h1>) I would write:

.myclass {
  font-size: 52;
}

Finally, if I wanted to target a specific header on my website I would add an id to that header ("<h1 id="header1234"></h1>) and then apply the appropriate id CSS in my stylesheet, as so:

#header1234 {
  font-size: 52;
}

Notice how the element, class, and id selectors each have different (or no) characters before them? Getting these selectors correct is the problem you're having in your code above, and this information should be at the back of your mind when you organize your HTML and CSS in the future.