Is this an acceptable use of float:right?

An example

<div style="float: right;">
<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="">
<input type="hidden" name="item_name" value="Baseball Hat">
<input type="hidden" name="item_number" value="123">
<input type="hidden" name="amount" value="5.95">
<input type="hidden" name="shipping" value="1.00">
<input type="hidden" name="shipping2" value="0.50">
<input type="hidden" name="handling" value="2.00 ">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="">
<input type="hidden" name="undefined_quantity" value="1">
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" width="87" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
</div>

Better example.

Am I using float: right correctly here?


<div style="width: 200px; height: 200px; background-color:#cc333f;color:#000000;">

<div style="float: right;">
<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="business" value="">
<input type="hidden" name="item_name" value="Baseball Hat">
<input type="hidden" name="item_number" value="123">
<input type="hidden" name="amount" value="5.95">
<input type="hidden" name="shipping" value="1.00">
<input type="hidden" name="shipping2" value="0.50">
<input type="hidden" name="handling" value="2.00 ">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="">
<input type="hidden" name="undefined_quantity" value="1">
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" width="87" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
</div>
</div>

Except for the use of “border:0” in the last <input>, it looks valid.

Why would this be wrong?

<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

The HTML validator says:

“The “border” attribute is obsolete. Consider specifying “img { border: 0; }” in CSS instead.”

that’s the way paypal has it by default.

Kinda like how youtube uses frameborder as default even though that’s obsolete.

We encourage you to verify your code according to current standards to make it more future-proof and cross-browser compatible.

2 Likes

It doesn’t seem paypal, youtube, etc, etc care to.

If the attribute is still being supported by browsers, the companies do not have to rush and spend money to fix it. That’s a business decision. Eventually the browsers will stop supporting the obsolete attributes then their code will “break” if they have not implemented a change by then.

1 Like

How does it cost money to take a tiny piece of code out?

Most people, especially businesses with large complex sites, are reluctant to change something that seems to be working for them. Besides that, changing a complex site even a tiny bit has the potential of introducing unexpected bugs, so considerable testing is needed. Time is salary money. Failures caused by bugs can cost the company big money in lost sales so developing a test plan and paying the testers is cheaper than risking a code failure… and so it goes.

Let’s consider the issue of one asasass and inline styls vs CSS styles or px vs ems, or ,

Trying to convince him to invest in himself by taking HTML and CSS classes or even taking our good adivice is like talking to a fence post. He either refuses to change or reverts back to the junky archaic inline code as soon as he can. We keep nudging him forward, though.

We all have our priorities. I have no idea what yours are. I hope you do, because you only get one shot at life. I’ve tried to make mine something I could be pleased to remember when I get old and not wasted.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.