I have a banner that I’d like to float in the middle of the page on desktop and fill the screen on mobile.
Here’s my CSS for media (set up by someone else)
}
@media(max-width:100%) {
height: auto;
img#image-6441-60781 {
padding-left: 0px;
padding-right: 0px;
}
}
@media(max-width:100%) {
height: auto;
.wp-block-image img {
width: auto !important;
height: auto !important;
}
And here’s the HTML I’m trying on the wordpress page (with html/source made into dummy text):
<figure style="max-width:450px;" class="wp-caption aligncenter"><a href="www.testlink.com">
<img alt="Gift Guide" src="123456.png">
</a>
</figure>
I’ve tried other things I’ve seen on this forum and they haven’t worked.
2
Answers
The media queries you’re using will target every device.
You can refer following break-points to target different devices and apply css accordingly.
You can also try something following.
You can solve this without media-queries. Those add unnecessary complexity in this case.
It’s always a good idea to include the height and with attributes on your img-tag in the html.