How to centre widgets / html

I have just created a click-to-call icon using the following code:

<a href="tel:07970XXXXXXX"><img src="http://mydomain/resources/phone_150px.png"></a>

All works perfectly but I need the linked image to be centred and have no idea how to do this. It defaults to left.

Just wrap it in a div with an inline style of text-align:center

<div style="text-align:center"><a href="tel:07970XXXXXXX"><img src=http://mydomain/resources/phone_150px.png"></a></div>
1 Like

Hi - I’ve tried this but still aligned to the left. Being a complete coding-no-hoper - does it need to be text align style when there’s an image?

here’s the code I tried:

<div style="text-align:centre"><a href="tel:07970102XXX"><img src=""></a></div>

No, just copy my code directly. You have just changed the spelling of center to the correct English version :stuck_out_tongue_winking_eye:

1 Like

perfect - many thanks! I really should go do some coding tuition!

Sorry to trouble you again but I have just replaced the jpg with a.png as I need transparency but can’t get it to appear. No reason why a png wouldn’t work is there?

Ignore last question - appears to be a preview issue in RW as is fine when published