Why is my CSS code not working properly on product pages?

Solved

Why is my CSS code not working properly on product pages?

Ciaranmci27
Shopify Partner
3 0 0

Hey Guys! I am having a weird issue with CSS executing properly on Shopify. I am using the code below to have a sizing bar for my clothing store, but no matter what I do the bar doesn't fill when added on my Shopify product pages. When I open the code locally it works perfectly but not on Shopify, I tried adding it as a custom liquid section, and adding it to the liquid files, and it doesn't seem like a conflicting styles issue because the classes are completely unique. What do you think this issue is? (code & images below)

Code:

<div class="size-guide-container">
    <span class="guide-title">Fitment Guide</span>

    <div class="guide-bar-bg">
        <div class="guide-bar-fill" style="width: 65%;"></div>
    </div>

    <div class="guide-labels">
        <span>Fits Small</span>
        <span>True to Size</span>
        <span>Oversized</span>
    </div>
</div>

<style>
.size-guide-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
    margin-bottom: 12px;
    width: 100%;
}

.guide-title {
    font-size: 1rem;
    font-weight: 800;
}

.guide-bar-bg {
    width: 100%;
    background-color: #A0AEC0;
    border-radius: 8px;
    height: 8px;
    position: relative;
}

.guide-bar-fill {
    height: 8px;
    background-image: linear-gradient(to right, #9F7AEA, #7B3ED8);
    border-radius: 8px;
    position: absolute;
    top: 0;
    left: 0;
}

.guide-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 700;
    width: 100%;
}
</style>


Locally:

Ciaranmci27_0-1696478680051.png


On Shopify Product Page:

Ciaranmci27_1-1696478707135.png

 

Accepted Solution (1)
Dan-From-Ryviu
Shopify Partner
11416 2241 2413

This is an accepted solution.

Hi @Ciaranmci27 

Please update your code to this

<div class="size-guide-container">
    <span class="guide-title">Fitment Guide</span>

    <div class="guide-bar-bg">
        <div class="guide-bar-fill" style="width: 65%;"></div>
    </div>

    <div class="guide-labels">
        <span>Fits Small</span>
        <span>True to Size</span>
        <span>Oversized</span>
    </div>
</div>

<style>
.size-guide-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
    margin-bottom: 12px;
    width: 100%;
}

.guide-title {
    font-size: 1rem;
    font-weight: 800;
}

.guide-bar-bg {
    width: 100%;
    background-color: #A0AEC0;
    border-radius: 8px;
    height: 8px;
    position: relative;
}

.guide-bar-fill {
    display: block !important;
    height: 8px;
    background-image: linear-gradient(to right, #9F7AEA, #7B3ED8);
    border-radius: 8px;
    position: absolute;
    top: 0;
    left: 0;
}

.guide-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 700;
    width: 100%;
}
</style>

Screenshot 2023-10-05 at 14.35.47.png

 

- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...
Sign up now.

View solution in original post

Replies 4 (4)

Dan-From-Ryviu
Shopify Partner
11416 2241 2413

Hi @Ciaranmci27 

Could you send product page link to check?

- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...
Sign up now.

Ciaranmci27
Shopify Partner
3 0 0

Here is a URL: https://racegallery.co/products/test-products

The website password is "race".  Thank you for your help!

Dan-From-Ryviu
Shopify Partner
11416 2241 2413

This is an accepted solution.

Hi @Ciaranmci27 

Please update your code to this

<div class="size-guide-container">
    <span class="guide-title">Fitment Guide</span>

    <div class="guide-bar-bg">
        <div class="guide-bar-fill" style="width: 65%;"></div>
    </div>

    <div class="guide-labels">
        <span>Fits Small</span>
        <span>True to Size</span>
        <span>Oversized</span>
    </div>
</div>

<style>
.size-guide-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
    margin-bottom: 12px;
    width: 100%;
}

.guide-title {
    font-size: 1rem;
    font-weight: 800;
}

.guide-bar-bg {
    width: 100%;
    background-color: #A0AEC0;
    border-radius: 8px;
    height: 8px;
    position: relative;
}

.guide-bar-fill {
    display: block !important;
    height: 8px;
    background-image: linear-gradient(to right, #9F7AEA, #7B3ED8);
    border-radius: 8px;
    position: absolute;
    top: 0;
    left: 0;
}

.guide-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 700;
    width: 100%;
}
</style>

Screenshot 2023-10-05 at 14.35.47.png

 

- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...
Sign up now.

websensepro
Shopify Partner
1869 220 266

Hi, @Ciaranmci27,

 

Follow These Steps.

Goto Online store > Assets > Edit code > find Base.css File and paste the code mentioned below.

 

.size-guide-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
    margin-bottom: 12px;
    width: 100%;
}

.guide-title {
    font-size: 1rem;
    font-weight: 800;
}

.guide-bar-bg {
    width: 100%;
    background-color: #A0AEC0;
    border-radius: 8px;
    height: 8px;
    position: relative;
}

.guide-bar-fill {
    height: 8px;
    background-image: linear-gradient(to right, #9F7AEA, #7B3ED8);
    border-radius: 8px;
    position: absolute;
    top: 0;
    left: 0;
}

.guide-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 700;
    width: 100%;
}

 

If I managed to help you then, don't forget to Like it and Mark it as Solution!

 

Best Regards,
Websensepro

Need a Shopify developer? Hire us at WebSensePro For Shopify Design Changes/Coding
For Free Tutorials Subscribe to our youtube
Get More Sales Using Big Bulk Discount APP
Create Your Shopify Store For Just 1$/Month
Get More Sales Using Big Bulk Discount APP