HighDots Forums  

float a SPAN to the right in a LI

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss float a SPAN to the right in a LI in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
asc4john
 
Posts: n/a

Default float a SPAN to the right in a LI - 10-13-2008 , 02:10 PM






I have <ul> <li> item text <span> count </span> </li><li> item text
<span> count </span> </li> </ul>
I want the span to right in the LI, but when I use float:right on the
SPAN it winds-up appearing in the next LI in the list, and the last
SPAN appears outside the list. The SPANs appear in the correct place
in the horizontal, but down "one" in the vertical. How to do it
correctly?

Reply With Quote
  #2  
Old   
Kevin Scholl
 
Posts: n/a

Default Re: float a SPAN to the right in a LI - 10-13-2008 , 02:50 PM






On Oct 13, 2:10*pm, asc4john <j... (AT) kinnear (DOT) ca> wrote:
Quote:
I have <ul> <li> item text <span> count </span> </li><li> item text
span> count </span> </li> </ul
I want the span to right in the LI, but when I use float:right on the
SPAN it winds-up appearing in the next LI in the list, and the last
SPAN appears outside the list. The SPANs appear in the correct place
in the horizontal, *but down "one" in the vertical. How to do it
correctly?
Generally speaking, floats have to ... hmmm, how to say this ... come
BEFORE the element they are floating against. So in your case, you
want the floated SPAN to go to the right of the base text within the
LI. So:

<ul>
<li><span>count</span> item text</li>
<li><span>count</span> item text</li>
<li><span>count</span> item text</li>
</ul>

If you want to maintain the "item text - count" ordering in the event
that the user doesn't have style sheets, you could set the text-
alignment of the LI to "right", then span the item text and float it
"left", thusly:

<ul>
<li><span>item text</span> count</li>
<li><span>item text</span> count</li>
<li><span>item text</span> count</li>
</ul>


Reply With Quote
  #3  
Old   
asc4john
 
Posts: n/a

Default Re: float a SPAN to the right in a LI - 10-13-2008 , 02:58 PM



On Oct 13, 12:50*pm, Kevin Scholl <ksch... (AT) comcast (DOT) net> wrote:
Quote:
On Oct 13, 2:10*pm, asc4john <j... (AT) kinnear (DOT) ca> wrote:

I have <ul> <li> item text <span> count </span> </li><li> item text
span> count </span> </li> </ul
I want the span to right in the LI, but when I use float:right on the
SPAN it winds-up appearing in the next LI in the list, and the last
SPAN appears outside the list. The SPANs appear in the correct place
in the horizontal, *but down "one" in the vertical. How to do it
correctly?

Generally speaking, floats have to ... hmmm, how to say this ... come
BEFORE the element they are floating against. So in your case, you
want the floated SPAN to go to the right of the base text within the
LI. So:

ul
* <li><span>count</span> item text</li
* <li><span>count</span> item text</li
* <li><span>count</span> item text</li
/ul

If you want to maintain the "item text - count" ordering in the event
that the user doesn't have style sheets, you could set the text-
alignment of the LI to "right", then span the item text and float it
"left", thusly:

ul
* <li><span>item text</span> count</li
* <li><span>item text</span> count</li
* <li><span>item text</span> count</li
/ul
aah, never thought of that, thanks you


Reply With Quote
  #4  
Old   
Kevin Scholl
 
Posts: n/a

Default Re: float a SPAN to the right in a LI - 10-13-2008 , 02:59 PM



On Oct 13, 2:58*pm, asc4john <j... (AT) kinnear (DOT) ca> wrote:
Quote:
On Oct 13, 12:50*pm, Kevin Scholl <ksch... (AT) comcast (DOT) net> wrote:



On Oct 13, 2:10*pm, asc4john <j... (AT) kinnear (DOT) ca> wrote:

I have <ul> <li> item text <span> count </span> </li><li> item text
span> count </span> </li> </ul
I want the span to right in the LI, but when I use float:right on the
SPAN it winds-up appearing in the next LI in the list, and the last
SPAN appears outside the list. The SPANs appear in the correct place
in the horizontal, *but down "one" in the vertical. How to do it
correctly?

Generally speaking, floats have to ... hmmm, how to say this ... come
BEFORE the element they are floating against. So in your case, you
want the floated SPAN to go to the right of the base text within the
LI. So:

ul
* <li><span>count</span> item text</li
* <li><span>count</span> item text</li
* <li><span>count</span> item text</li
/ul

If you want to maintain the "item text - count" ordering in the event
that the user doesn't have style sheets, you could set the text-
alignment of the LI to "right", then span the item text and float it
"left", thusly:

ul
* <li><span>item text</span> count</li
* <li><span>item text</span> count</li
* <li><span>item text</span> count</li
/ul

aah, never thought of that, thanks you
Welcome. :-)


Reply With Quote
  #5  
Old   
dorayme
 
Posts: n/a

Default Re: float a SPAN to the right in a LI - 10-13-2008 , 05:46 PM



In article
<5abddc93-0536-482c-b4fa-7cbcce7f8fbe (AT) 1g2000prd (DOT) googlegroups.com>,
Kevin Scholl <kscholl (AT) comcast (DOT) net> wrote:

Quote:
On Oct 13, 2:10*pm, asc4john <j... (AT) kinnear (DOT) ca> wrote:
I have <ul> <li> item text <span> count </span> </li><li> item text
span> count </span> </li> </ul
I want the span to right in the LI, but when I use float:right on the
SPAN it winds-up appearing in the next LI in the list, and the last
SPAN appears outside the list. The SPANs appear in the correct place
in the horizontal, *but down "one" in the vertical. How to do it
correctly?

Generally speaking, floats have to ... hmmm, how to say this ... come
BEFORE the element they are floating against. So in your case, you
want the floated SPAN to go to the right of the base text within the
LI. So:

ul
li><span>count</span> item text</li
li><span>count</span> item text</li
li><span>count</span> item text</li
/ul

If you want to maintain the "item text - count" ordering in the event
that the user doesn't have style sheets, you could set the text-
alignment of the LI to "right", then span the item text and float it
"left", thusly:

ul
li><span>item text</span> count</li
li><span>item text</span> count</li
li><span>item text</span> count</li
/ul
But watch for fun and games with bullets in different browsers if you do
this last! Perhaps best turn bullets off so the problem does not appear.

--
dorayme


Reply With Quote
  #6  
Old   
robert.jalarvo@gmail.com
 
Posts: n/a

Default Re: float a SPAN to the right in a LI - 10-14-2008 , 04:58 AM



On 13 loka, 20:50, Kevin Scholl <ksch... (AT) comcast (DOT) net> wrote:

Quote:
Generally speaking, floats have to ... hmmm, how to say this ... come
BEFORE the element they are floating against. So in your case, you
want the floated SPAN to go to the right of the base text within the
Great, thanks!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.