G
G
Greg Plitt2018-08-12 21:32:08
css
Greg Plitt, 2018-08-12 21:32:08

How to stretch images to full width on a mobile site?

Hello.
In order for the image to stretch to the full width of the page, I used the following code:

<style>
@media only screen and (min-width : 320px) and (max-width : 480px) {
 img {width: 100%;}
}
</style>

I inserted it directly into the post page (WordPress), for those pages where there were images in the body of the article.
But later, I found that on some pages, it does not work correctly.
Example, screenshot - https://clip2net.com/s/3W0XpQp
The page with the problem is here - https://goo.gl/5EyGG6
How can I fix the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Leo Mavrin, 2018-08-13
@bit24yes

You have the align: left class on your figure parent. What is causing the flow to the left of the image?

@media only screen and (min-width : 320px) and (max-width : 480px) {
 img {width: 100%;}
 .alignleft {
    float: none;
 }
}

S
snap44, 2018-08-12
@snap44

For figure#attachment_70 the width is 100%. You have 300px specified, the picture is stretched to a maximum of 300px

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question