# How to centre widgets / html

**URL:** <https://forums.realmacsoftware.com/t/how-to-centre-widgets-html/12120>\
**Category:** RapidWeaver Classic\
**Created:** [January 22, 2017, 1:31pm UTC](https://forums.realmacsoftware.com/t/how-to-centre-widgets-html/12120 "2017-01-22T13:31:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![manofdogz](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/manofdogz/32/26314_2.png) [@manofdogz](https://forums.realmacsoftware.com/u/manofdogz)\
**Post date:** [January 22, 2017, 1:31pm UTC](https://forums.realmacsoftware.com/t/how-to-centre-widgets-html/12120/1 "2017-01-22T13:31:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tav](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/tav/32/5458_2.png) [@tav](https://forums.realmacsoftware.com/u/tav)\
**Post date:** [January 22, 2017, 1:51pm UTC](https://forums.realmacsoftware.com/t/how-to-centre-widgets-html/12120/2 "2017-01-22T13:51:38Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![manofdogz](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/manofdogz/32/26314_2.png) [@manofdogz](https://forums.realmacsoftware.com/u/manofdogz)\
**Post date:** [January 22, 2017, 2:04pm UTC](https://forums.realmacsoftware.com/t/how-to-centre-widgets-html/12120/3 "2017-01-22T14:04:58Z")

</div>

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>`

---

<div class="post-metadata">

**Author:** ![tav](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/tav/32/5458_2.png) [@tav](https://forums.realmacsoftware.com/u/tav)\
**Post date:** [January 22, 2017, 2:22pm UTC](https://forums.realmacsoftware.com/t/how-to-centre-widgets-html/12120/4 "2017-01-22T14:22:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![manofdogz](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/manofdogz/32/26314_2.png) [@manofdogz](https://forums.realmacsoftware.com/u/manofdogz)\
**Post date:** [January 22, 2017, 2:50pm UTC](https://forums.realmacsoftware.com/t/how-to-centre-widgets-html/12120/5 "2017-01-22T14:50:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![manofdogz](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/manofdogz/32/26314_2.png) [@manofdogz](https://forums.realmacsoftware.com/u/manofdogz)\
**Post date:** [January 22, 2017, 10:04pm UTC](https://forums.realmacsoftware.com/t/how-to-centre-widgets-html/12120/6 "2017-01-22T22:04:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![manofdogz](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/manofdogz/32/26314_2.png) [@manofdogz](https://forums.realmacsoftware.com/u/manofdogz)\
**Post date:** [January 22, 2017, 10:08pm UTC](https://forums.realmacsoftware.com/t/how-to-centre-widgets-html/12120/7 "2017-01-22T22:08:22Z")

</div>

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