Code: Select all
img {
width:100%;
height:auto;
}How do you fix this?
UPDATE AND SOLUTION: I gave up on this issue but have come back to it and I believe I have found a solution. Use this code:
Code: Select all
img {
max-width:100%;
height:auto;
}ANOTHER UPDATE: 5/24/2016
So sometimes you have small images that you want to be responsive, but the max-width:100% makes them too large. And making them max-width:50% makes the image smaller, but when you resize, the image only takes up half the width of the page, which looks bad on mobile.
HOWEVER, say your small image is 401px. If you set max-width to 400px, the small image will then take up the full screen width, which can look bad. This is because for some reason, max-width needs to greater than or equal to the original width of the image.
Example:
If you have an image that is 400px, and want to keep the original width of that image, but also make it responsive so that when the screen width goes below 400px, the image will start to re-size, you would need the code:
Code: Select all
img {
width:100%;
height:auto;
max-width:400px;
}