How to centre widgets / html


(LJ) #1

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.


(Andrew Tavernor) #2

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>

(LJ) #3

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="http://mydomain.com/resources/phone_150px.png"></a></div>


(Andrew Tavernor) #4

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


(LJ) #5

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


(LJ) #6

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?


(LJ) #7

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