2011-06-26 73 views
3

我需要做到以下几点:李跨度浮浮左向右

|text1| lots of text lots of text lots |text3| 
lots of text lots of text lots of text lots 
of text 

它的结构为:

<li><span>text1</span><span>text3</span><span>lots of text</span></li> 

文字3是浮动的权利。

问题是我需要在很多文本上设置宽度,因为我需要背景色来填充整行的宽度。如果我将它设置为float:left,它将沿着一条线并且与text1或text2不在同一行。

+2

它不是很明显你特林做什么。也许最后看的形象将有助于 – Ibu

回答

7

<li>
<span id="left">text1</span>
<span class="withbg">lots of text</span>
<span id="right">text3</span>
</li>

跨度{
浮动:左;
display:inline;
}
span.withbg {
width:200px;
背景:红色;
}

它在这里jsFiddle

+0

尝试这一个,如果我得到你的意思,那么这一个应该工作.. – rrapuya

+0

1如何在那里..? :-) – rrapuya