Failing in centre aligning my text of text component in JS

URL of experiment: https://gitlab.pavlovia.org/NathaciaLR/understanding-input-information

Description of the problem:
Again, I’ve seen several similar posts, but I’m still struggling with finding a working solution.
I have centre aligned instructions in my local experiment. But it goes left aligned in JS.
I tried manually cutting the sentences instead of allowing the program to wrap them… still left-aligned (the first line is centered, all the others follow the left edge of the first to left aligning). I tried using the text.alignHoriz = ‘center’; I tried text.setAlignHoriz(‘center’) (I used the code component in the builder bc I have no idea on how to edit the JS code); I tried text.alignText = ‘center’…
None of this worked.
Any Ideas?

You need to use

TextName.setAlignHoriz('center')

where TextName is the name of your text component that you want to center. You need to add a line for each text component you want to center (e.g. TextName1.setAlign…, TextName2.setAlign…, etc.)

To do this, add a code component on the first Routine page and insert the code in the Begin Routine tab. You only have to do this once if you include all the text components you want to center.

Be aware, you will get an error if you try to test your experiment offline (i.e. by hitting the running man in PsychoPy). You will have to delete this component to test offline.

1 Like

Omg! Thank you very much! It worked PERFECTLY.