Removing padding above and below an image in custom liquid code.

Removing padding above and below an image in custom liquid code.

Davieholt
Visitor
1 0 1

Hi, here is my link to the store.

tasteinmusic.store/collection/taylors-collection

 

I am having trouble removing the padding above and below the image. the blue for the custom liquid code. for the banner image i have created an implemented using custom liquid code. here is my code. 

 

 

<!-- Custom Banner Section -->
<div class="banner-section">
<img src="https://cdn.shopify.com/s/files/1/0654/1226/8183/files/Untitled_design_7.png?v=1723346593" alt="Banner Image" class="banner-image">
<div class="banner-text-wrapper">
<div class="banner-text">Shop Our Collection Of Premium Taylor Swift Posters</div>
<a href="#MainContent" class="btn-buy-now">Buy Now</a>
</div>
</div>

<style>
/* Reset all margins and padding */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

/* Ensure the body and html have no margin or padding */
html, body {
margin: 0;
padding: 0;
height: 100%;
}

/* Banner Section */
.banner-section {
position: relative;
width: 100%;
overflow: hidden;
background-color: transparent; /* Ensure no background color is showing */
padding: 0; /* Remove any padding */
margin: 0; /* Remove any margins */
display: block;
}

/* Banner Image */
.banner-image {
width: 100%;
height: auto; /* Maintain the aspect ratio */
display: block;
margin: 0; /* Remove any margins */
padding: 0; /* Remove any padding */
position: relative; /* Ensure no extra space around the image */
}

/* Banner Text Wrapper */
.banner-text-wrapper {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
background: rgba(255, 255, 255, 0.5); /* Slight background for text contrast */
}

/* Banner Text */
.banner-text {
color: #ff6f61;
font-size: 28px;
font-weight: bold;
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
padding: 12px 20px;
background: rgba(255, 255, 255, 0.7);
border-radius: 8px;
text-align: center;
}

/* Buy Now Button */
.btn-buy-now {
margin-top: 20px;
padding: 16px 40px;
background-color: #ff6f61;
color: #FFFFFF;
text-decoration: none;
font-weight: bold;
border-radius: 8px;
font-size: 20px;
text-align: center;
}

/* Button Hover Effect */
.btn-buy-now:hover {
background-color: #e05b4f;
color: #FFFFFF;
}

/* Responsive Design */
@media (max-width: 768px) {
.btn-buy-now {
padding: 14px 35px;
font-size: 18px;
}

.banner-text {
font-size: 22px;
padding: 10px 18px;
}
}

@media (max-width: 480px) {
.btn-buy-now {
padding: 12px 30px;
font-size: 16px;
}

.banner-text {
font-size: 20px;
padding: 8px 16px;
}
}

/* Smooth Scrolling */
html {
scroll-behavior: smooth;
}
</style>

Replies 3 (3)

niraj_patel
Shopify Partner
2378 514 508

Hello @Davieholt 

You can add code by following these steps

1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.liquid file

3. Paste the below code before </body> on theme.liquid
<style>
@media screen and (min-width: 750px) {
  .section-sections--17242064158871__custom_liquid_P4rBzJ-padding {
      padding-top: 0 !important;
      padding-bottom: 0 !important;
  }
}
</style>

niraj_patel_0-1723471528140.png

Was my reply helpful? Click Like to let me know!
Was your question answered? Mark it as an Accepted Solution.

Shopify Partner || Helping eCommerce Stores
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution.
- For further discussion contact: Email ID- info@techlyser.com

BSS-TekLabs
Shopify Partner
2401 695 827

BSSTekLabs_0-1723471618489.png

Do you want like this @Davieholt 

 

If our suggestions are useful, please let us know by giving it a like or marking it as a solution.


Salepify: Efficiently increase sales conversion with sale-driven features like auto add to cart, free gifts (free plan available)


Salemate: Boost your AVO with 2-layer offer, countdown upsell in your post purchase page


BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now
BSS-TekLabs
Shopify Partner
2401 695 827

- Here is the solution for you @Davieholt 
- Please follow these steps:

z5686811214059_e66de1953f1db631f9134af5cdb796ad.jpg

- Then find the base.css or theme.css file.
- Then add the following code at the end of the file and press 'Save' to save it.

.section-sections--17242064158871__custom_liquid_P4rBzJ-padding {
 padding: 0 !important
}

- Here is the result you will achieve:

BSSTekLabs_0-1723471714723.png

 

- Please press 'Like' and mark it as 'Solution' if you find it helpful. Thank you.

If our suggestions are useful, please let us know by giving it a like or marking it as a solution.


Salepify: Efficiently increase sales conversion with sale-driven features like auto add to cart, free gifts (free plan available)


Salemate: Boost your AVO with 2-layer offer, countdown upsell in your post purchase page


BSS Commerce - Full-service eCommerce Agency | Use Shopify for 1$ in the first month now