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

How can I center the text for the choices in a drop down menu

  • May 17, 2022
  • 1 reply
  • 461 views

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?

1 reply

bgooldfed
Level 4 ●●●●
Forum|alt.badge.img+25
  • Level 4 ●●●●
  • May 18, 2022

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!