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 trialPaul Barron
6,595 PointsImage Not Responsive
I've tried just about everything and it's driving me nuts. How can I make the "slide-img" image responsive. This is what I have and the website is 132media.com. When I open it on my phone's browser the image is showing way too big. I just realized that the image is doing exactly what I want it to do, but the rest of the site is not filling the screen.
slide {
background: black;
position: relative;
max-width: 100%;
z-index: -1;
margin: 0;
padding: 0;
}
.slide-img {
display: block;
margin: 0 auto;
max-width: 100%;
}
4 Answers
Aaron Elliott
11,738 PointsAdd this to your stylesheet
html, body{ width:100%;
}
Paul Barron
6,595 PointsYou read my mind. I'll give it a look soon.
Paul Barron
6,595 PointsAaron Elliott hey I bought the book. Wow! Really does clear up things. Thanks for the recommendation.
Aaron Elliott
11,738 PointsHey no problem Paul. Glad the book helped you too.
Paul Barron
6,595 PointsPaul Barron
6,595 PointsRIght on the money. Both answers. I was doing one, but not with the other. I don't know how I missed the html and body, but I did :(. It's always something so simple ey? Thanks Aaron.
Aaron Elliott
11,738 PointsAaron Elliott
11,738 PointsNo Problem Paul,
That would have become an even bigger problem once the JS was introduced to control the slider behavior. For more info on how to build a full page responsive slider I recommend the new JavaScript and jQuery book by Jon Ducket.