Having problems centering text after being clicked

Started messing around with the dev tools today to try changing the colour of text in a text box after it is clicked. Currently it’s changing colour but it’s also aligning itself to the left and I can’t seem to get it working. The text is supposed to go from black Avenir Light, centered, 16px font size to gold Avenir Light, centred, 16px font size. Here’s my code so far:

export function Home_click(event, $w) {
//Add your code for this event here:
$w(‘#Home’).html = ‘

Home
’;
}

Could someone please point out where I’ve gone wrong?

Hi,
Your HTML code looks a bit off, I would recommend for you to check this post and modify your code to look like the example code below.
Your code should look like this:

$w("#Home").html = "<h5 style='text-align: center; color: red'>Home<h5/>";

Good luck :slight_smile:

Thanks, it works great!