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.
Written by Alex Sears
Related protips
2 Responses
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#