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 trialTony Helsel
337 PointsHow do i make an image smaller on my webpage
How do i make an image smaller on my webpage right now it is very big and it puishes everything around
4 Answers
Damien Watson
27,419 PointsAs mentioned width and height, but a lot of responsive sites these days will use max-width which means that the image will not push out of its container and push things around.
img { max-width:100%; }
james south
Front End Web Development Techdegree Graduate 33,271 Pointsyou can set the size with css, width and height.
Trevor Johnson
14,427 PointsYou can set the size by creating a class for the image.
.img {
width: 200px;
height: 200px;
}
If you are using bootstrap you can use the ".image-responsive" class too.
quincy ganious
1,972 Pointsstill does not work for me for some weird reason. this is my code just for testing it out i wanted to start small and i also wrapped the images with <div class="img"> </div> and its still acting up
.img { max-width: 40; max-height:40;
}