We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Custom Liquid Block alignment issue

Custom Liquid Block alignment issue

LB2024
Tourist
5 0 1

Can anyone help with a quick fix for this issue?

LB2024_0-1732727435358.png


I need the custom liquid block to align with the rest of the page. Here's the code ChatGPT gave me:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Black Friday Secret Sale</title>
<style>
/* Container for centering the block */
.block-container {
display: flex;
justify-content: center; /* Center horizontally */
align-items: center; /* Center vertically */
width: 100%; /* Full-width block */
min-height: 400px; /* Adjust height to fit your design */
margin: 0 auto; /* Center within its parent container */
}

/* Center the image-container inside the block-container */
.image-container {
position: relative;
width: 100%;
max-width: 1200px; /* Adjust as needed */
text-align: center; /* Center the button */
}

/* Image styling for responsiveness */
.image-container img {
width: 100%;
height: auto;
display: block;
}

/* Button styling */
.image-container button {
position: absolute;
top: 50%; /* Center vertically over image */
left: 50%; /* Center horizontally over image */
transform: translate(-50%, -50%);
background-color: #d44100;
color: white;
border: none;
padding: 12px 30px;
font-size: 18px;
font-weight: 600;
cursor: pointer;
border-radius: 3px;
transition: background-color 0.3s ease;
}

/* Button hover effect */
.image-container button:hover {
background-color: #000000;
}

/* Adjust for smaller screens */
@media (max-width: 600px) {
.image-container button {
font-size: 14px; /* Reduce font size */
padding: 8px 20px; /* Adjust padding */
}
}
</style>
</head>
<body>

<!-- Centered Block -->
<div class="block-container">
<div class="image-container">
<img alt="Black Friday Secret Sale" src="https://cdn.shopify.com/s/files">
<button class="klaviyo_form_trigger">UNLOCK SECRET SALE HERE</button>
</div>
</div>

<script type="text/javascript">
document.querySelector('.klaviyo_form_trigger').addEventListener('click', function () {
window._klOnsite = window._klOnsite || [];
window._klOnsite.push(['openForm', 'form_id']);
});
</script>

</body>
</html>

Replies 6 (6)

Moeed
Shopify Partner
7764 2081 2567

Hey @LB2024 

 

Welcome to Shopify Community! Can you share your Store URL so I can have a look on it? Also, if you have password enabled then please share the password as well. Your cooperation would be greatly appreciated.

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


LB2024
Tourist
5 0 1

Hi, there! the url is modernblaze.com

Moeed
Shopify Partner
7764 2081 2567

Hey @LB2024 

 

I'm unable to locate this section on your website, can you tell me on which page is that?

 

Best Regards,

Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Get a quick Shopify quote – Click here!

- Custom Design | Advanced Coding | Store Modifications


LB2024
Tourist
5 0 1

the page was initially hidden because we were testing it. here you go: https://modernblaze.com/pages/test

LB2024
Tourist
5 0 1

The issue only becomes visible on desktop when it's zoomed out more than 90% 

LB2024
Tourist
5 0 1

Is there something about CSS or is the issue in the actual custom liquid block?