tags:

views:

22

answers:

2

Hi,

I have the following li item:

<li>
  <span style='float:left; background-color:red'>a</span>
  <span style='float:left; background-color:green'>b</span>
</li>

I'd like the span on the right to fill whatever width is remaining in its parent li. Is there a way to do that?

Thanks

+3  A: 

Don't float the second one, and make it display:block.

http://jsfiddle.net/ymAt5/

cnanney
+1  A: 

You don't want to float each of them left, only the first one, and then make the second one display in block mode:

<li>
  <span style='float:left; background-color:red'>a</span>
  <span style="display: block; background-color:green;">b</span>
</li>
Michael Shimmins