Home > Back-end >  image doesn't auto fix by simulating Ipad screen size
image doesn't auto fix by simulating Ipad screen size

Time:11-05

I am using wordpress to develop a website called normal

ipad

I added the css code corresponding to the screen in css, but it still has no any effect:

@media only screen and (max-width: 768px) {
    img.sslsecure {
    background-attachment: scroll;
    }

CodePudding user response:

It is doing exactly what it should do, it takes up 40% of the width of it's parent div. When you inspect the element, you can see that the parent actually almost takes up 100% of the screen width.

You can fix this by adding extra css for different screen sizes. This can be done in the theme you are using.

Or you can add extra css and write a media query yourself.

See:

https://www.w3schools.com/css/css_rwd_mediaqueries.asp

Edit.

I just saw that you've tried adding a media query. You did it right, yet you have to change the width of the element or the parent element. background-attachment: scroll; only applies to elements with a background-image. Since this is an img, it doesn't apply to this element.

Let'say, I don't want the image to be wider than 100px:

@media only screen and (max-width: 768px) {
 img.sslsecure {
  max-width: 100px;
 }
}
  • Related