Resolved

Variations won’t align to center on product page

Polestar Theme started by George Feb 23, 2020 10 replies
George Feb 23, 2020 · 6:48 pm #14034

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!

Andrew Misplon Puro Feb 24, 2020 · 10:55 am #14035

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.

George Feb 24, 2020 · 12:38 pm #14040

This reply has been marked as private.

Andrew Misplon Puro Feb 24, 2020 · 7:16 pm #14041

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.

George Feb 24, 2020 · 8:12 pm #14042

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?

Andrew Misplon Puro Feb 25, 2020 · 8:55 am #14043

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;
	}

}
George Feb 25, 2020 · 6:49 pm #14045

Hi Andrew,

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

George Feb 25, 2020 · 6:56 pm #14046

This reply has been marked as private.

Andrew Misplon Puro Feb 25, 2020 · 6:58 pm #14047

Glad to hear you’re making progress 🙂

.bk-social-proof-embed .social-proof-widget.widget-balance {
	justify-content: center;
}
George Feb 26, 2020 · 4:34 am #14049

Worked like a charm. You’re awesome ?

Andrew Misplon Puro Feb 26, 2020 · 8:36 am #14050

Super 🙂 Glad that helped.

11 posts