user379888
user379888

Reputation:

Why doesn't this PayPal button center align?

I have the following code to center align a PayPal donate button on a website but it still does not center align. Please guide why. Thanks.

<form     width: 50%;
    margin: 0 auto; action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_donations"><input type="hidden" name="business" value="[email protected]"><input type="hidden" name="lc" value="US"><input type="hidden" name="item_name" value="Naya Jeevan Foundation"><input type="hidden" name="item_number" value="26-0551721"><input type="hidden" name="no_note" value="0"><input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest"><input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

JSFIDDLE.

Upvotes: 1

Views: 6602

Answers (4)

user4688751
user4688751

Reputation:

Add the following attribute style to your input type='image':

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

Updated fiddle: http://jsfiddle.net/xfosrkpx/3/

Upvotes: 1

Jenti Dabhi
Jenti Dabhi

Reputation: 880

You can add css

CSS:
form{
   text-align: center;
}

see demo http://jsfiddle.net/JentiDabhi/mmp848ww/

Upvotes: 0

user379888
user379888

Reputation:

There is a syntax error in my question. The style item needs to be inside a style tag.

<form    style=" width: 50%;
    margin: 0 auto;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_donations"><input type="hidden" name="business" value="[email protected]"><input type="hidden" name="lc" value="US"><input type="hidden" name="item_name" value="Naya Jeevan Foundation"><input type="hidden" name="item_number" value="26-0551721"><input type="hidden" name="no_note" value="0"><input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHostedGuest"><input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

Upvotes: 0

Bluety
Bluety

Reputation: 1909

You can add text-align:center; on your <form>.

The <input> is an inline element, you can center like a text with text-align:center;.

Upvotes: 0

Related Questions