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
Shams Nelson
2,888 PointsWhat the best way to make this page responsive?
Also, any tips or insights on the overall design or offer in terms of conversions would be appreciated.
I tried to do @media screen and (min-width: 660px)
container { width: 100%; margin: 0; }
but it didn't work...
3 Answers
Shams Nelson
2,888 PointsBasically I want the box that has all the content (in a div called #container) to fit the width of the iphone and for the image to fit the width too. If you take the browser and make it thin (width-wise) you'll see how the page is responsive in that case.... but this doesn't translate onto the iphone for some reason.
Sahil Prajapati
8,524 PointsIts not working on your iPhone because its screen dimensions are 320 x 480. And in your media query you are not handling it. Whenever the viewport size goes less than 600px or 500px, you can remove the float from the image and give it a 100% width or make it a block element, so that it takes the entire row. Even the font-size can be reduced for a smaller device. For eg;
<style>
/*Because you already have defined media query for min width of 400px*/
@media screen and (max-width:399px){
/*Reduce the margins for smaller screen devices*/
#container{
margin: 8px auto;
font-size:12px;
}
#content{
padding:10px;
}
#content img {
display: block;
height: 183px;
margin: 7px auto;
float:none;
width: 60%;
}
/*Making the textboxes take the full width*/
form input{
display:block;
}
}
</style>
Try this out and let me know.
Shams Nelson
2,888 PointsThanks for the answer Sahil! I'm following what you're saying mostly but...
I'm a little confused tho... why do you have the width set at 60% instead of 100 (or close to 100)??
edit: ugh, copied in in and still no luck...
Sahil Prajapati
8,524 PointsIt was to avoid the image being overstreched. You can probably remove the height property from the declaration so that it maintains the aspect ratio and keep the image width around 60-70%. If you keep it as 100% the image will be large, you can try playing with the image width and see.
Shams Nelson
2,888 PointsOh, I meant about this part:
container{
margin: 8px auto; width:60%; font-size:18px; }
Sahil Prajapati
8,524 PointsSorry, didnt see that there's no need for width property for #container. I have updated the answer now.

Sahil Prajapati
8,524 PointsSahil Prajapati
8,524 PointsHi
You have max-width constraint on your page which stops it from taking 100% of your screen width on screens having viewport > 700px. Its still not clear how you want the webpage to look on different screens.