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 trialKristian Woods
23,414 Pointsmedia query isn't working
After the media query the nav and logo elements are supposed to stack on top of each other. However, in my case, the nav elements are stacked BESIDE the logo, not UNDERNEATH.
/*Page Styles*/
body {
font: normal 1.1em/1.5 sans-serif;
color: #222;
background-color: #edeff0;
}
.main-wrapper {
width: 90%;
margin: auto;
}
* {
box-sizing: border-box;
}
/*Layout Element Colors*/
.main-header {background-color: #384047; }
.main-logo {background-color: #5fcf80; }
.main-nav li {background-color: #3f8abf; }
.primary-content {background-color: #caebf6; }
.secondary-content {background-color: #bfe3d0; }
.main-footer {background-color: #b7c0c7; }
/*Header, Banner and Footer Layout*/
.main-header {
padding: 20px;
display: table;
width: 100%;
min-height: 150px;
}
.main-logo,
.main-nav,
.main-nav li {
display: inline-block;
}
.main-logo,
.main-nav {
display: table-cell;
vertical-align: middle;
}
.main-nav {
padding-left: 50px;
}
.main-logo,
.main-nav li {
border-radius: 5px;
}
.main-nav li {
margin-right: 10px;
}
.main-logo a,
.main-nav a {
color: white;
text-decoration: none;
display: block;
text-align: center;
padding: 10px 20px;
}
.main-nav li {
list-style: none;
}
/* Media Queries*/
@media screen and (max-width: 768px) {
.main-logo,
.main-nav
.main-nav li {
display: block;
width: initial;
margin: initial;
}
.main-nav {
padding-left: initial;
}
.main-nav li {
margin-top: 15px;
}
}
2 Answers
Dale Bailey
20,269 PointsYou're missing a comma
@media screen and (max-width: 768px) {
.main-logo,
.main-nav /* < Right here */
.main-nav li {
display: block;
width: initial;
margin: initial;
}
.main-nav {
padding-left: initial;
}
.main-nav li {
margin-top: 15px;
}
}
Kristian Woods
23,414 PointsHey, Dan! Thank you so much!