views:

29

answers:

2

I'm using this

.align-left {
   float: left;
   width: 49%;
   }
.align-right {
   float: right;
   width: 49%;
   text-align: right; /* depends on element width */
   }

With this html:

<span class="align-left">this shows to the left<span><span class="align-right">this to the right<span>

And it works fine in IE/FF but not in Chrome? I'm no CSS expert but I'd like to avoid using tables, any suggestions?

+5  A: 

Close your span tags and it will work.

See example: http://jsfiddle.net/ESQE7/

Matt
+1, you beat me to it
Chris
`display:none`? what about `display:block`?
Dan Heberden
Thanks that helps :)
Floating spans is fine, a span is used (without display:block;) in the CSS2 specs as an example floating element: http://www.w3.org/TR/CSS2/visuren.html#floats
Douglas
I think the problem may be that I actually have a <form> element within that second <span>, which works ok in the other browsers but not in Chrome? Using divs now, which works fine. Thanks!
ps: I had my span tags closed, just typed the code badly here.
A: 

Why don't you better try something like this ?

<div style="float:left">left</div>
<div style="float:right">right</div>

I think this might work for you.

Keep me posted.

UXdesigner
you're recommending inline css? **cold chill** (hoping it was for the short div not span example...)
Dan Heberden