Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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;