Shopify themes, liquid, logos, and UX
Hi, I am struggling to align my Buy Button center for screens smaller than desktop. I want the button to be aligned left for desktop, which it currently is, but I cannot find how to target it for smaller screens.
See button on website here: https://leejamesabbott.com/inner-impulsion.html
<style>
@media screen and (max-width: 767px) {
.shopify-buy__btn-wrapper {
margin-top: 5px !important;
margin-left: 10px !important;
}
button.shopify-buy__btn {
display: flex !important;
justify-content: center !important;
}
}
</style>
i think you want this one
Go to online store ----> themes ----> go to three Dots ----> edit code ---->find theme.liquid files ----> place the code ---->
before the body ----->
if this code work please do not forget to like and mark it solution
Thanks, but this is not a theme. I've tried putting this before the <body> as you sugested but it does not work. I also tried within the <head> tag but it does not work either. Any suggestions?
Hey @Leeeroy
Follow these Steps:
1) Go to Online Store
2) Edit Code
3) Find theme.liquid file
4) Add the following code in the bottom of the file above </body> tag
<style>
@media screen and (max-width: 767px) {
.shopify-buy__btn-wrapper {
text-align: -webkit-center !important;
}
article.col-md-6.text-left {
text-align: -webkit-center !important;
}
}
</style>
RESULT:
If I managed to solve your problem then, don't forget to Like it and Mark it as Solution!
Best Regards,
Moeed
Thanks, but this is not a theme. I've tried putting this before the <body> as you suggested but it does not work. Any suggestions?
hello @Leeeroy
1.Go to Online Store
2) Edit Code
3) Find theme.liquid file
4) Add the following code in the bottom of the file above </body> tag
@media screen and (max-width: 767px) {
.shopify-buy__btn-wrapper {
text-align: center !important;
}
}
thanks
Thanks, but this is not a theme. I've tried putting this before the <body> as you suggested but it does not work. Any suggestions?
Hi @Leeeroy,
Please send the website link, I will check it for you
Hi @Leeeroy,
I checked and it is an HTML page, not Shopify.
Is this what you want?
Yes, I am using the Shopify buy button on a HTML page
Hi @Leeeroy,
Please send me the HTML render code, I will check and change it
Hi @Leeeroy,
Please change all code:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-54382215-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-54382215-2');
</script>
<!-- Basic Page Info
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta charset="utf-8">
<title>LJA Art</title>
<meta name="description" content="Art portfolio website of Vancouver artist Lee James Abbott">
<meta name="author" content="Lee James Abbott">
<!-- Mobile Specific Metas
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Favicon
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<script src="/cdn-cgi/apps/head/4goYFhL6vVIOoiwidPehYiiPPVQ.js"></script><link rel="icon" type="image/png" href="images/favicon.png" />
<!-- FONT
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="stylesheets/stylesheet.css" type="text/css" charset="utf-8" />
<!-- ICON FONTS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<script src="https://unpkg.com/ionicons@4.5.5/dist/ionicons.js"></script>
<script src="https://kit.fontawesome.com/66fabe116e.js" crossorigin="anonymous"></script>
<!-- CSS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="stylesheets/bootstrap.css">
<link rel="stylesheet" href="stylesheets/sinister.css">
<link rel="stylesheet" href="stylesheets/slimmenu.css">
<link rel="stylesheet" href="stylesheets/main.css">
<link rel="stylesheet" href="stylesheets/main-responsive.css">
</head>
<body>
<!-- Preloader
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div id="preloader">
<div id="status"></div>
</div>
<!-- end : preloader -->
<!-- Mobile Only Navigation
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<nav class="mobile-nav ">
<ul class="slimmenu font2">
<li><a href="index.html">Work</a></li>
<li><a href="about.html">About</a></li>
<li><a href="shop.html">Shop</a></li>
<li><a href="mailto:hello@leejamesabbott.com">Say Hello</a></li>
</ul>
</nav>
<!-- mobile only navigation : ends -->
<!-- Header
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<section class="logo-header">
<div class="logo-block">
<a href="index.html"><img alt="" title="" width="80px" class="img-responsive" src="images/logo.svg"></a>
</div>
<div class="social-block">
<ul>
<li><a href="https://www.instagram.com/leejamesabbott/"><ion-icon size="large" name="logo-instagram"></ion-icon></a></li>
</ul>
</div>
</section>
<header class="masthead ">
<div class="container">
<div class="row">
<article class="col-md-8 text-left no-pad">
<nav class="mastnav ">
<ul class="main-menu ">
<li><a class="main-link font2" href="index.html">Work</a></li>
<li><a class="main-link font2" href="about.html">About</a></li>
<li><a class="main-link font2" href="shop.html">Shop</a></li>
<li><a class="main-link font2" href="mailto:hello@leejamesabbott.com">Say Hello</a></li>
</ul>
</nav>
</article>
</div>
</div>
</header>
<!-- end : masthead -->
<!-- MASTER CONTENT
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<section class="mastwrap">
<section class="container about pad-top pad-bottom">
<div class="row">
<article class="col-md-5 text-left inner-pad">
<h6 class="super-text font1 black">Inner Impulsion</h6>
</article>
</div>
</section>
<section class="container project-video-wrap">
<div class="project-video responsive-video-embed">
<picture>
<source srcset="images/works/inner-impulsion.webp" type="image/webp">
<source srcset="images/works/inner-impulsion.jpg" type="image/jpeg">
<img loading="lazy" alt="Inner Impulsion" title="" class="img-responsive" src="images/inner-impulsion.jpg">
</picture>
</div>
</section>
<section class="container-outer white-bg">
<section class="container about pad-top pad-bottom">
<div class="row">
<article class="col-md-6 text-left">
<p class="black">"Inner Impulsion"</p>
<p class="black">18"x24" Acrylic on glass, acrylic on paper.</p>
<p class="black">2022</p>
<div id='product-component-1742677656328'></div>
<script type="text/javascript">
/*<![CDATA[*/
(function () {
var scriptURL = 'https://sdks.shopifycdn.com/buy-button/latest/buy-button-storefront.min.js';
if (window.ShopifyBuy) {
if (window.ShopifyBuy.UI) {
ShopifyBuyInit();
} else {
loadScript();
}
} else {
loadScript();
}
function loadScript() {
var script = document.createElement('script');
script.async = true;
script.src=scriptURL;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(script);
script.onload = ShopifyBuyInit;
}
function ShopifyBuyInit() {
var client = ShopifyBuy.buildClient({
domain: '91deae-e6.myshopify.com',
storefrontAccessToken: '3156c92da95e32d57284f93df3bba868',
});
ShopifyBuy.UI.onReady(client).then(function (ui) {
ui.createComponent('product', {
id: '8659540312293',
node: document.getElementById('product-component-1742677656328'),
moneyFormat: '%24%7B%7Bamount%7D%7D',
options: {
"product": {
"styles": {
"product": {
"@media (min-width: 601px)": {
"max-width": "calc(25% - 20px)",
"margin-left": "20px",
"margin-bottom": "50px",
"text-align": "left"
},
"text-align": "center"
},
"button": {
"font-family": "Candara, sans-serif",
":hover": {
"background-color": "#000000"
},
"background-color": "#000000",
":focus": {
"background-color": "#000000"
}
}
},
"contents": {
"img": false,
"title": false,
"price": false
},
"text": {
"button": "Add to cart"
}
},
"productSet": {
"styles": {
"products": {
"@media (min-width: 601px)": {
"margin-left": "-20px"
}
}
}
},
"modalProduct": {
"contents": {
"img": false,
"imgWithCarousel": true,
"button": false,
"buttonWithQuantity": true
},
"styles": {
"product": {
"@media (min-width: 601px)": {
"max-width": "100%",
"margin-left": "0px",
"margin-bottom": "0px"
}
},
"button": {
"font-family": "Candara, sans-serif",
":hover": {
"background-color": "#000000"
},
"background-color": "#000000",
":focus": {
"background-color": "#000000"
}
}
},
"text": {
"button": "Add to cart"
}
},
"option": {},
"cart": {
"styles": {
"button": {
"font-family": "Candara, sans-serif",
":hover": {
"background-color": "#000000"
},
"background-color": "#000000",
":focus": {
"background-color": "#000000"
}
}
},
"text": {
"total": "Subtotal",
"button": "Checkout"
},
"popup": false
},
"toggle": {
"styles": {
"toggle": {
"font-family": "Candara, sans-serif",
"background-color": "#000000",
":hover": {
"background-color": "#000000"
},
":focus": {
"background-color": "#000000"
}
}
}
}
},
});
});
}
})();
/*]]>*/
</script>
</article>
<article class="col-md-6 text-left">
<p class="black">Mental well-being is a vital part of a thriving life, and open conversations can foster understanding, connection, and support. When we replace stigma with compassion, we create a world where everyone feels seen, heard, and empowered to seek help when needed.</p>
<p class="black"><br>My exhibition, 1 in 3, highlights the reality that one in three adults in Canada will experience mental health challenges at some point in their lives. Through art, they spark meaningful dialogue, encourage healing, and inspire a more compassionate society—one where mental health is embraced as an essential part of our shared experience. In support of this mission, 20% of sales from the show were donated to the Canadian Mental Health Association, helping to provide resources and support for those in need.</p>
</article>
</div>
</section>
</section>
</section>
<!-- end : mastwrap -->
<!-- FOOTER
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<footer class="mastfoot">
<div class="container">
<div class="row">
<article class="col-md-6 text-left">
<h3 class="font1 black">Lee James Abbott</h3>
<h6 class="font2 black">Painter & Printmaker living in beautiful British Columbia. <br>Stay updated on new prints and projects on my <a href="https://mailchi.mp/1c7a9383b32e/subscribe" class="underline">mailing list</a></h6>
</article>
<article class="col-md-5 col-md-offset-1 text-right">
<h3 class="font2 silver">©</h3>
<h6 class="font2 black">© <span id="year"></span> LJA<br/><a href="index.html">Work</a> | <a href="shop.html">Shop</a> | <a href="mailto:hello@leejamesabbott.com">Say Hello</a></h6>
</article>
</div>
</div>
<script>
document.getElementById("year").textContent = new Date().getFullYear();
</script>
</footer>
<!-- end : mastfoot -->
<!-- End Layout
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<!-- JS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<script type="text/javascript" src="x-javascripts/libs/common.js"></script>
<script type="text/javascript" src="x-javascripts/custom/main.js"></script>
<script type="text/javascript" src="/javascripts/custom/shopify.js"></script>
<style>
@media screen and (max-width: 767px) {
.shopify-buy__btn-wrapper {
margin-top: 5px !important;
margin-left: 10px !important;
}
button.shopify-buy__btn {
display: flex !important;
justify-content: center !important;
}
} </style>
</body>
</html>
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025