[Resolved] Variations won’t align to center on product page

  • Author
    Posts
  • #14034

    George
    Participant

    Hi team,

    I’m trying to center align product title, price, variations and add to cart button on product page. I came up with this code:

    body.single-product #main .post .entry-summary{
    	text-align:center;
    }

    However product variations are still on the left side after applying the code. Please help!

    #14035

    Andrew Misplon
    Keymaster

    Hi George

    Thanks for reaching out.

    Please, send a link to an existing product and I’ll take a look at what you’ve done so far.

    #14040

    George
    Participant
    This reply has been marked as private.
    #14041

    Andrew Misplon
    Keymaster

    Thanks, variations are contained in an HTML table. I’m not sure that there is an easy way to achieve what you’re after here. If you right-click and inspect element and take a look at how the table is constructed, it’ll help to understand what’s going on there.

    The following will center align the text within each table cell:

    .single-product .variations tr {
    	text-align: center;
    }

    Alternatively, the following will center align the second table cell but right align the first table cell, probably better for what you’re trying to do:

    .single-product .variations tr {
    	text-align: center;
    }
    
    .single-product .variations tr .label {
    	text-align: right;
    }

    Polestar is loading both the min and non-min stylesheet which isn’t correct. I’m not quite sure that’s happening. Go to Dashboard > Updates, there should be a theme update pending. If so, try updating to see if that issue resolves. I can check once you’ve updated.

    #14042

    George
    Participant

    Hey Andrew,

    I’ve updated the theme and added the code you provided. The result can be seen on the link I sent. It is better than before but not best.

    I basically need to apply this on the mobile version of my website. Is there a way to implement it only on mobile and leave it as it is for desktop?

    #14043

    Andrew Misplon
    Keymaster

    Sure, you could wrap the rule in a media query:

    @media (max-width: 768px) {
    
    	.single-product .variations tr {
    		text-align: center;
    	}
    
    	.single-product .variations tr .label {
    		text-align: right;
    	}
    
    }
    #14045

    George
    Participant

    Hi Andrew,

    Thank you, that’s what I was looking for 🙂

    #14046

    George
    Participant
    This reply has been marked as private.
    #14047

    Andrew Misplon
    Keymaster

    Glad to hear you’re making progress 🙂

    .bk-social-proof-embed .social-proof-widget.widget-balance {
    	justify-content: center;
    }
    #14049

    George
    Participant

    Worked like a charm. You’re awesome ?

    #14050

    Andrew Misplon
    Keymaster

    Super 🙂 Glad that helped.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.

Scroll to top