Liquid, JavaScript, themes, sales channels
To continue receiving payouts, you need to secure your account by turning on two-step authentication. If two-step authentication is not turned on your payouts will be paused. Learn more
I have 3 elements made with Custom content > Custom html on the homepage using Debut theme. Each set to 33% so they stretch nicely on desktop.
They are simple images with text links positioned on the bottom.
HTML:
<div class="container-txt-img"> <img src="#" alt="Bespoke Design"> <div class="container-txt-img-bottom"><a href="#">Bespoke Design</a></div> </div>
CSS:
.container-txt-img { position: relative; width: 100%; height: auto; text-align: center; color: black; font-size:24px; } .container-txt-img-bottom { position: absolute; bottom: 3px; left: 50%; transform: translate(-50%, -50%); }
I can't figure out how to make these boxes responsive, the text is centered on mobile.
I've tried to implement solutions from other threads to no avail.
Got any ideas? TIA
Solved! Go to the solution
This is an accepted solution.
OK I got. It in case anyone else needs to solve this here's what I've done.
In short I'm going to hide my 3 column custom HTML for mobile visitors. Then create 3 rows of custom HTML, each 100% width and show them on mobiles only.
HTML for desktop (Custom content block, containing 3x Custom HTML element set to 33% width):
<div class="container-txt-img"> <img src="#" alt="Bespoke Design"> <div class="container-txt-img-bottom"><a href="#">Bespoke Design</a></div> </div>
HTML for mobile (Custom content block, containing 3x Custom HTML element set to 100% width):
<div class="container-txt-img-mobile"> <img src="#" alt="Bespoke Design"> <div class="container-txt-img-bottom"><a href="#">Bespoke Design</a></div> </div>
CSS:
.container-txt-img { position: relative; width: 100%; height: auto; text-align: center; color: black; font-size:24px; } .container-txt-img-bottom { position: absolute; bottom: 3px; left: 50%; transform: translate(-50%, -50%); } @media only screen and (max-width: 425px) { .container-txt-img{ display:none;} } @media only screen and (min-width: 426px) { .container-txt-img-mobile{ display:none;} }
Hello @barch,
Please share your site url so that I will give you exact solution
It's here: {REDACTED}
Edit: I've solved it, see answer below.
I'm now thinking I may wrap up the whole image as clickable link if that's any difference, thanks.
This is an accepted solution.
OK I got. It in case anyone else needs to solve this here's what I've done.
In short I'm going to hide my 3 column custom HTML for mobile visitors. Then create 3 rows of custom HTML, each 100% width and show them on mobiles only.
HTML for desktop (Custom content block, containing 3x Custom HTML element set to 33% width):
<div class="container-txt-img"> <img src="#" alt="Bespoke Design"> <div class="container-txt-img-bottom"><a href="#">Bespoke Design</a></div> </div>
HTML for mobile (Custom content block, containing 3x Custom HTML element set to 100% width):
<div class="container-txt-img-mobile"> <img src="#" alt="Bespoke Design"> <div class="container-txt-img-bottom"><a href="#">Bespoke Design</a></div> </div>
CSS:
.container-txt-img { position: relative; width: 100%; height: auto; text-align: center; color: black; font-size:24px; } .container-txt-img-bottom { position: absolute; bottom: 3px; left: 50%; transform: translate(-50%, -50%); } @media only screen and (max-width: 425px) { .container-txt-img{ display:none;} } @media only screen and (min-width: 426px) { .container-txt-img-mobile{ display:none;} }
Hi Barch,
hope you're well.
I know this post is solved, but im trying to get my images to do the same. Just confused about where to put the CSS within the custom HTML code ive created. im pretty new to this.
https://lily-m-beauty.myshopify.com/ this is my url
this is my password
prufri
Best wishes
Hi @iMendez ,
CSS style goes into one of the theme files while HTML goes on the page where you want to display your images.
To get to the theme files, go to
Online Store > Themes > Customize
then on the bottom
Theme actions > Edit code
then search for "css" and paste the CSS on the bottom of theme.scss.liquid file.
Good luck!
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022