Forum Moderators: open

Message Too Old, No Replies

Tricky one. Checkout buttons in a horizontal line

PayPal CO, Google CO, etc.

         

salewit

4:41 am on Oct 24, 2009 (gmt 0)

10+ Year Member



I'm redesigning a checkout page, and have 3 payment checkout "buttons". Internal Visa/MC button, Google Checkout button, and a PayPal checkout button. I'm having nightmares trying to keep these in a horizontal line as they cross over multiple forms. I tried wrapping the whole thing in a DIV, but it didn't work. Here's a simplified example:


<!--#### BUTTON 1 Our Merchant-->
<a href="checkout.php"><img src="images/credit_card_logos.gif" alt="Checkout Using Our Secure Server"></a>

<!--#### BUTTON 2 Google Checkout -->
<form method="post" action="https://checkout.google.com/cws/v2/Merchant/123456/checkoutForm" accept-charset="utf-8">
<input type="hidden" name="item_name_1" value="Widget">
<input type="hidden" name="item_price_1" value="10.99">
<input type="image" name="Google Checkout" alt="Fast checkout through Google" src="https://checkout.google.com/buttons/checkout.gif?merchant_id=123456&amp;w=160&amp;h=43&amp;style=white&amp;variant=text&amp;loc=en_US">
</form>

<!--#### BUTTON 3 PayPal Checkout -->
<form method="post" action="Start_PP_API.php">
<input type="hidden" name="L_NAME1" value="Widget">;
<input type="hidden" name="L_AMT1" value="10.99">;
input type="image" src='http://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif'>
</form>

Can anyone suggest a way to get these in a straight horizontal line?

piatkow

9:24 am on Oct 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I can't remember all the css necessary for this sort of thing, if I didn't have the time to look it up (which I don't now) I would take the quick and dirty approach and just slap it all in a table.

swa66

12:39 pm on Oct 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the extra difficulty you have is that those external images have whitespace in them. I'm not sure if your images have it or not, assuming they have none.

There are a few ways to get this done with CSS alone.

First you can make it inline and if any of them ends up in the wrong position, find a way to select it and nudge it using relative positioning.

e.g.:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test</title>
<style type="text/css">
* {
padding: 0;
margin: 0;
}
p {
background-color: fuchsia;
}
#checkout {
text-align: center;
padding-top: 12px;
margin-bottom: -4px;
}
#checkout a, #checkout form {
display: inline;
}
#checkout fieldset {
display: inline-block;
border: 0;
}
#checkout a img {
border: 0;
position:relative;
bottom: 12px;
}
</style>
</head>
<body>
<p>BEFORE</p>
<div id="checkout">
<!-- BUTTON 1 Our Merchant-->
<a href="checkout.php"><img src="2s.jpg" alt="Checkout Using
Our Secure Server" /></a>
<!-- BUTTON 2 Google Checkout -->
<form method="post" action="#"
accept-charset="utf-8">
<fieldset>
<input type="hidden" name="item_name_1" value="Widget" />
<input type="hidden" name="item_price_1" value="10.99" />
<input type="image" name="Google Checkout" alt="Fast checkout
through Google" src="https://checkout.google.com/buttons
/checkout.gif?merchant_id=123456&amp;w=160&amp;h=43&amp;
style=white&amp;variant=text&amp;loc=en_US" />
</fieldset>
</form>
<!-- BUTTON 3 PayPal Checkout -->
<form method="post" action="#">
<fieldset>
<input type="hidden" name="L_NAME1" value="Widget" />
<input type="hidden" name="L_AMT1" value="10.99" />
<input type="image" src='http://www.paypal.com/en_US/i/btn
/btn_xpressCheckout.gif' />
</fieldset>
</form>
</div>
<p>AFTER</p>
</body>
</html>

I did mess a bit with the html to make it valid code.

I did break some lines to prevent the forum from scrolling sideways, glue them back together ...

The other way is to use a container that has position (e.g. by giving it position:relative, and then use absolute positioing to place the children whereever you like.