Center product page info on mobile only

Solved

Center product page info on mobile only

kirsten11123
Shopify Partner
41 0 14

Hello!

 

My theme automatically center aligns certain product info on the MOBILE product page, however it doesn't do all of the info I want. Can someone please help me with coding the intro offer section and the inventory tracker to be centered too? The description and everything below the line can stay left aligned.

 

Thank you!

 

Screenshot 2024-07-02 at 9.34.04 PM.png 

site: https://healing-purpose.myshopify.com/products/organic-wild-blueberry-powder

password: hello123*

Accepted Solution (1)
Moeed
Shopify Partner
4309 1106 1354

This is an accepted solution.

Apologies for the confusion, just simply add this code then.

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) {
.feature-badge {
    width: 100% !important;
    place-content: center !important;
}
variant-inventory.inventory.text-warning {
    place-content: center !important;
}
}
</style>

RESULT:

Moeed_0-1719928201940.png

 

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

 

Best Regards,
Moeed

Need a Shopify Specialist? Chat on WhatsApp


- Custom Design | Advanced Coding | Store Modifications
- Your Coffee Tip and my code, A perfect blend. ❤️

View solution in original post

Replies 7 (7)

Moeed
Shopify Partner
4309 1106 1354

Hey @kirsten11123 

 

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) {
.product-info__block-list {
    text-align-last: center !important;
    text-align: center !important;
}
.variant-picker.v-stack.gap-4 {
    justify-items: center !important;
}
.variant-picker__option-info.h-stack.justify-between.gap-2 {
    justify-self: center !important;
}
}
</style>

RESULT:

Moeed_0-1719927644405.png

 

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

 

Best Regards,
Moeed

Need a Shopify Specialist? Chat on WhatsApp


- Custom Design | Advanced Coding | Store Modifications
- Your Coffee Tip and my code, A perfect blend. ❤️
kirsten11123
Shopify Partner
41 0 14

Hi! Thank you, that did work, however I'm hoping to only target the text with green background and the inventory notice. Is there any way to just target those elements?

Moeed
Shopify Partner
4309 1106 1354

This is an accepted solution.

Apologies for the confusion, just simply add this code then.

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) {
.feature-badge {
    width: 100% !important;
    place-content: center !important;
}
variant-inventory.inventory.text-warning {
    place-content: center !important;
}
}
</style>

RESULT:

Moeed_0-1719928201940.png

 

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

 

Best Regards,
Moeed

Need a Shopify Specialist? Chat on WhatsApp


- Custom Design | Advanced Coding | Store Modifications
- Your Coffee Tip and my code, A perfect blend. ❤️
kirsten11123
Shopify Partner
41 0 14

Thank you, that's fabulous!

Moeed
Shopify Partner
4309 1106 1354

Thank you for your reply. I'm glad to hear that the solution worked well for you. If you require any more help, please don't hesitate to reach out. If you find this information useful, a Like would be greatly appreciated.

Need a Shopify Specialist? Chat on WhatsApp


- Custom Design | Advanced Coding | Store Modifications
- Your Coffee Tip and my code, A perfect blend. ❤️
vm-web
Shopify Partner
29 1 4

@kirsten11123 

Hi! Thank you, that did work, however I'm hoping to only target the text with green background and the inventory notice. Is there any way to just target those elements?

Solution

Please add the following CSS code to your assets/theme.css bottom of the file.

@media screen and (max-width: 767px) {
.feature-badge {
    display: flex !important;
    margin: 0 auto !important;
    justify-content: center !important;
}
}

Thanks!

 

If helpful then please Like and Accept Solution.

vm-web
Shopify Partner
29 1 4

@kirsten11123 

Please add the following CSS code to your assets/theme.css bottom of the file.

@media screen and (max-width: 767px) {
.product-info__block-list {
    text-align-last: center !important;
    text-align: center !important;
}
.variant-picker.v-stack.gap-4 {
    justify-items: center !important;
}
.variant-picker__option-info.h-stack.justify-between.gap-2 {
    justify-self: center !important;
}
}

Thanks!

If helpful then please Like and Accept Solution.