How to resize some images on Mobile

Solved
Highlighted
New Member
14 0 0

Hello!

I have looked up so many questions about resizing and responsive images, but not 1 code worked for me, so without wasting any more time:

I have made some pages on my website where you have tables with two images next to each other. For desktop it's the perfect size, but I want to show the images under each other on Mobile. So not two images next to each other but each image alone full width. How do I do that?

Another question is how do I make the add to cart button AND the button that is shown in the pop up screen green?

URL is https://casa-sarani.myshopify.com/ 

Thanks in advance!

0 Likes
Highlighted

Hi Salma,

the store is locked. Can you share the password to see the page you created so far?

• If the problem is solved remember to click ✅ to Accept Solution
• Press Like, if the answer was helpful
• Shopify/Shopify Plus custom development, optimization and consulting. You can hire me here.
0 Likes
Highlighted
New Member
14 0 0

Thanks for your quick response.

Totally forgot, the password is sobaob

0 Likes
Highlighted
New Member
14 0 0

I am btw talking about the Woonstijlen page, there you see two images next to each other (didn't know how to do that without a table) and I want them just below each other on Mobile.

0 Likes
Highlighted

@Salma93 

Do this to fix it in 20 seconds:

1. In your Shopify Admin go to: online store > themes > actions > edit code
2. Find Asset > theme.scss.liquid and paste this at the bottom of the file:

 

 

@media (max-width: 767px){
    .template-page .scrollable-wrapper table,
.template-page .scrollable-wrapper table *{
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    border: unset !important;
    table-layout: unset !important;

}
}

 

 


Please let me know whether it works.

Kind regards,
Diego

◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Needing urgent help? I'm available for hire, same day response guaranteed: diego.boarutto.fortes@gmail.com
◦ My app free for limited time: Add a navigation styled like Instagram Stories to your website!
0 Likes
Highlighted

I suggest you to take a look to Flexbox (A Complete Guide to Flexbox)

I just coded this really really fast, just to give you a vague idea how you can do.

 

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            max-width: 800px;
            margin: 0 auto;
        }

        .r-table {
            display: flex;
            flex-direction: column;
            max-width: 100%;
        }

        .r-row {
            display: flex;
            flex-direction: row;
        }

        .r-row img {
            width: 50%;
            max-width: 100%;
        }

        @media screen and (max-width: 768px) {
            .r-row {
                display: flex;
                flex-direction: column;
            }

            .r-row img {
                width: 100%;
                max-width: 100%;
            }
        }
    </style>

</head>

<body>


    <div class="r-table">
        <div class="r-row">
            <img
                src="https://cdn.shopify.com/s/files/1/0460/6433/7049/files/shutterstock_569066257_dab38693-f96a-46c4-8791-26e1743fb393_480x480.jpg?v=1603661816">
            <img
                src="https://cdn.shopify.com/s/files/1/0460/6433/7049/files/shutterstock_1186883524_480x480.jpg?v=1602187868">
        </div>
        <div class="r-row">
            <img
                src="https://cdn.shopify.com/s/files/1/0460/6433/7049/files/shutterstock_1256220994_480x480.jpg?v=1602187883">
            <img
                src="https://cdn.shopify.com/s/files/1/0460/6433/7049/files/shutterstock_549055441_480x480.jpg?v=1602187820">
        </div>
        <div class="r-row">
            <img src="https://cdn.shopify.com/s/files/1/0460/6433/7049/files/shutterstock_1014304372.jpg?v=1602189280">
            <img
                src="https://cdn.shopify.com/s/files/1/0460/6433/7049/files/shutterstock_1023862996_5.jpg?v=1602190135">
        </div>
        <div class="r-row">
            <img
                src="https://cdn.shopify.com/s/files/1/0460/6433/7049/files/shutterstock_293425643_480x480.jpg?v=1602273422">
            <img
                src="https://cdn.shopify.com/s/files/1/0460/6433/7049/files/shutterstock_1224557752_480x480.jpg?v=1602447732">
        </div>
    </div>

</body>

</html>

 

 

• If the problem is solved remember to click ✅ to Accept Solution
• Press Like, if the answer was helpful
• Shopify/Shopify Plus custom development, optimization and consulting. You can hire me here.
0 Likes
Highlighted
New Member
14 0 0

Hi Diego,

Thanks! That worked, one little thing though: it only shows the left 4 images, how can I add the right images to them as well?

0 Likes
Highlighted

This is an accepted solution.

@Salma93 

Oh, my bad, I missed that. 

Replace the code with this one:

@media (max-width: 767px) {
    .template-page .scrollable-wrapper table,
    .template-page .scrollable-wrapper table * {
        width:100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        border: unset !important;
        table-layout: unset !important;
        display: block !important;
    }

    .template-page .scrollable-wrapper table td:nth-child(2){
        margin-top: 30px !important;
    }
}
◦ Problem Solved? ✔️ Please click on Accept as Solution and like.
◦ Needing urgent help? I'm available for hire, same day response guaranteed: diego.boarutto.fortes@gmail.com
◦ My app free for limited time: Add a navigation styled like Instagram Stories to your website!
0 Likes
Highlighted
New Member
14 0 0

Thank you so much for the quick response and your help, that worked as a charm!

 

May I ask one other thing I couldn't find the answer to in the other discussions: how can I make the ADD TO CART BUTTON, CART BUTTON (that shows in the pop up when you put something in it) and the PAY BUTTON green? #1ABD19

Thank you in advance Diego.

0 Likes