admin管理员组

文章数量:1122846

I am using WordPress buttons I would like to know how to align Button on the right of the image on desktop but below the image on mobile.

Here is an example:

Please see the amazon buttons on this page.

On desktop this buttons align to the right. like this:

and on mobile the buttons are below the image:

Thanks!

I am using WordPress buttons I would like to know how to align Button on the right of the image on desktop but below the image on mobile.

Here is an example: https://www.verywellfit.com/best-ankle-weights-4158657

Please see the amazon buttons on this page.

On desktop this buttons align to the right. like this:

and on mobile the buttons are below the image:

Thanks!

Share Improve this question asked May 29, 2020 at 20:31 alizaibkhan4alizaibkhan4 1
Add a comment  | 

1 Answer 1

Reset to default 0

CSS would check the width of the screen, and (if small enough), change the display of the picture to block. As taught by W3Schools ...

<style>
.the-image,
.the-price {
    display: inline-block;
}
@media only screen and (max-width:600px) {
    .the-image {
        display: block;
    }
}
</style>
<img class="the-image" src="...">
<div class="the-price">...</div>

本文标签: How to align Button on the right of the image on desktop but below the image on mobile