How to centralise a Paypal button with HTML

By | May 7, 2012

How to centralise a Paypal button?

For some reason, Paypal buttons when pasted into HTML on a web page always default to the left. You can insert as many <align=”center”> tags as you like and it wont make a blind bit of difference.

Centralising a Paypal button using HTML has always been a pain. Until recently, even after much Googling, the only way I had found to do this was to publish the button first, right click it and copy the URL, and use the link to link to a hosted image on my server and ditch the Paypal generated code. Not ideal.

There are other ways that involve tweaking the CSS or creating complex tables that all seemed too hard and beyond my modest HTML skills. I wanted something simple.

Today, quite by chance, I found out how to do it using just HTML, no tables, no CSS tweaks, nothing complicated at all. Simply a minor modification of the Paypal button code.

Here is what you do:

In the Paypal generated button code, find this line:

<input type=”image” src=”https://www.paypal.com…..

In between the words “input” and “type” you write this:

style=”display: block; margin: 0 auto;”

So it now reads like this:

<input style=”display: block; margin: 0 auto;” type=”image” src=”https://www.paypal.com…….

And that’s it! 

Try it. It works.

If you have been Googling for the answer to this without success already, do tell us if it worked or you using the comments box below.

Feel free to link to this topic on a forum if someone else asks the question.

Leave a Reply

Your email address will not be published. Required fields are marked *

Why ask?