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 How to Make a Website Customizing Colors and Fonts Use Classes in CSS

How 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
Damien Watson
27,419 Points

As 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%; }
Trevor Johnson
Trevor Johnson
14,427 Points

You 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
quincy ganious
1,972 Points

still 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;