Reply To: How can I centralize my text in the middle of the screen?

PennController for IBEX Forums Support How can I centralize my text in the middle of the screen? Reply To: How can I centralize my text in the middle of the screen?

#7879
Jeremy
Keymaster

Hi Larissa,

You can use .print("center at 50vw", "middle at 50vh") as illustrated in the Masked Priming template to print any element at the exact center of the page

You can use fullscreen to invite the browser to go fullscreen

If you need to print some content slightly above or below the vertical middle of the page, you could do something like this:

newTrial(
    newButton("go fullscreen").print().wait().remove(),fullscreen()
    ,
    newText("above").css("margin-bottom","1em").print("center at 50vw","bottom at 50vh")
    ,
    newText("below").css("margin-top","1em").print("center at 50vw","top at 50vh")
    ,
    newButton("center").print("center at 50vw","middle at 50vh").wait()
)

Jeremy