2011-06-26 69 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