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

Killeon Patterson
Killeon Patterson
18,214 Points

Responsive Design's media queries are overriding other breakpoints rules

I built my css using a mobile second approach, mistakingly. I use three separate rules to define the queries; (max-width: 568px) (max-width: 768px) (max-width: 1024px)

I'm added

When I attempt to make a change in the 1024px query, it overrides all others. If I attempt to change the rules from (max) to (min) it overrides my everything? On another site I'm testing, the views all look good until I landscape view?

What would be the appropriate breakpoints and syntax?

@media only screen and (max-width : 480px) {
.title h1 {
font-size: 10px;
margin-left: 2%;
font-family: 'Orbitron', sans-serif;
}

.mantra h1 {  color: white;
  font-size: 10px;
  position: relative;
  margin-top: -28%;
  text-align: center;
  font-family: 'Amatic SC', cursive;
}

.icon {
position: absolute;
margin-left: 15%;
margin-top: 5%;
width: 70%;
border: 1px solid #e5e5ff;
}

.icon p {
color: white;
font-size: 8px;
font-weight: 300;
letter-spacing: 1px;
margin-left: 0;
text-align: center;
font-family: 'Roboto', sans-serif;
}

}

@media only screen and (max-width : 768px) {

.title h1 {
font-size: 10px;
margin-left: 2%;
font-family: 'Orbitron', sans-serif;
}

.mantra h1 {
  color: white;
  font-size: 15px;
  position: relative;
  margin-top: -28%;
  text-align: center;
  font-family: 'Amatic SC', cursive;
}

.icon {
position: absolute;
margin-left: 15%;
margin-top: 5%;
width: 70%;
border: 1px solid #ccccff;
}

.icon p {
color: white;
font-size: 8px;
font-weight: 300;
letter-spacing: 1px;
margin-left: 0;
text-align: center;
font-family: 'Roboto', sans-serif;
}

}

@media only screen and (max-width : 992px) {




.title h1
{
font-size: 10px;
margin-left: 2%;
font-family: 'Orbitron', sans-serif;
}




.mantra h1
{
  color: white;
  font-size: 20px;
  position: relative;
  margin-top: -28%;
  text-align: center;
  font-family: 'Amatic SC', cursive;

}



.icon 
{
position: absolute;
margin-left: 15%;
margin-top: 5%;
width: 70%;
border: 1px solid #e5e5ff;

}

.icon p
{
color: white;
font-size: 8px;
font-weight: 300;
letter-spacing: 1px;
margin-left: 0;
text-align: center;
font-family: 'Roboto', sans-serif;

}

}

2 Answers

I think that your media queries definitely need to be min-width first off. Here's some code that addresses the landscape orientation problem

@media only screen and (min-width: 768px),
       only screen and (min-width: 700px) and (orientation: landscape) 

I'm not to sure but try @media screen (then the size)