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

HTML

My HTML site is not adjusting correctly when I pull it on a mobile device. It is giving me the desktop layout instead

I am building my first site and the HTML site does not seem to be adjusting to the mobile version. Below is the code I used for the responsive.css page. Help please

@media screen and (min-width: 480px) {

/******************************** TWO COLUMN LAYOUT ********************************/

#primary { width: 50%; float: left; }

#secondary { width: 40%; float: right; }

/****************************** 3 * 5 = 15 100%-15% = 85% 85 / 3 = 28.333333333333 *******************************/

/******************************** PAGE PORTFOLIO ********************************/

#gallery li { width: 28.3333%;}

#gallery li:nth-child(3n+1){ clear: left;}

}
/******************************** PAGE ABOUT ********************************/

@media screen and (min-width: 660px) {

/********************************

Header ********************************/

nav {
background: none;
float: right;
font-size: 1.125em;
text-align: right;
width: 45%;
}

#logo {
  float: left;
  margin-left: 5%;
  text-align: left;
  width: 45%;
}

h1 {
  font-size: 2.5em;
  text-align: left;
}

h2 {
  font-size: 0.825em;
  margin-bottom: 20px;
}

header {
  border-bottom: 5px solid #599a68;
  margin-bottom: 60px;
}

}

2 Answers

Biwash almost has it right. Just a little typo in the tag:

<meta name="viewport" content="width=device-width, initial-scale=1">

Thank you for help. This correction fixed the problem.

you might need to add below line in the head section of html:

<meta name="viewport" content="width=device-width", initial-scale=1.0">

Thank you. This was frustrating me but I made this correction and it fixed everything.