How can I center the text for the choices in a drop down menu | XM Community
Skip to main content

I am currently using this code
jQuery("#"+this.questionId+" .Selection").css("text-align","center");

on the survey preview the text is centered ( mobile and desktop) , this is what I want.
But the issue is when I test the survey on my phone , nothing is being centered.
How can I fix this issue?

Hi adelkhn,
Unfortunately this isn't possible with CSS, at least across all browsers. Common "solutions" include:
//alledgedly works on Chrome and Firefox
text-align: center;
text-align-last: center;

padding-left: calc(50% - 2em); //not perfect but pretty close

  • Adding blank divs inside each box and adjusting their width to center the text (sounds pretty messy)


Good luck!


Leave a Reply