Last Updated: May 28, 2020
·
764
· searsaw

Responsive Images

I couldn't seem to make the height of my images resize correctly with their containers. Here is the code I found to make the height scale also.

img {
    width: 100%;
    height: auto;
}

This will scale your images' heights to match the width with the correct proportions.

2 Responses
Add your response

There are alot of cool concepts you can learn from Bootstrap by looking through the CSS source code. It's a great way to learn some professional tips...if you have the time, of course! Haha

over 1 year ago ·

Nice! I might say max-width if you are applying universally in case the image needs to be smaller than the parent

over 1 year ago ·