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 - Beyond the Basics Working with Media Queries Adaptive Layouts Challenge

Dmitrii Shatrovskii
Dmitrii Shatrovskii
14,119 Points

Cannot go through the third task of adaptive layouts challenge

I've placed the rule ".extra {display: block;}" everywhere I could but it still won't help.

style.css
/* Phones to Tablets */
.extra {
    display: block;
  }

@media all and (min-width: 481px) {

  .col {
    float: left;
  }

.main {
    width: 65.957446808511%;
}
.secondary {
    width: 31.914893617021%; 
}
.secondary,
.extra {
    margin-left: 2.127659574468%;
  display: block;
}

  .extra {
    display: block;
  }
}
/* Tablets to Desktop */
@media all and (min-width: 769px) {
  .logo {
    float: left;
  }

  .main-nav {
    float: right;
  }

.main {
    width: 40.425531914894%;
}
.extra {
    width: 23.404255319149%;
  display: block;
}

  .extra {
    display: block;
  }
}
index.html
<!DOCTYPE html>
<html>
<head>
    <title>Media Queries</title>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="wrap">
        <header class="main-header">
            <a class="logo" href="#">Logo</a>
            <nav class="main-nav">
                <a href="#">Link 1</a>
                <a href="#">Link 2</a>
                <a href="#">Link 3</a>
                <a href="#">Link 4</a>
            </nav>
        </header>
        <div class="content">
            <div class="main col">
                Main
            </div>
            <div class="secondary col">
                Secondary
            </div>
            <div class="extra col">
                Extra
            </div>
        </div>
        <footer class="main-footer">
            Footer
        </footer>
    </div>
</body>
</html>

2 Answers

the .extra element modified has to be inside the second media query:

/* Phones to Tablets */


@media all and (min-width: 481px) {

  .col {
    float: left;
  }

.main {
    width: 65.957446808511%;
}
.secondary {
    width: 31.914893617021%; 
}
.secondary,
.extra {
    margin-left: 2.127659574468%;
}

}
/* Tablets to Desktop */
@media all and (min-width: 769px) {
  .logo {
    float: left;
  }

  .main-nav {
    float: right;
  }

.main {
    width: 40.425531914894%;
}
.extra {
    width: 23.404255319149%;
  display: block;
}

}/*end of media query*/

removed all the unnecessary .extras from the code