2010-12-11 69 views
0

我想讓我的浮動元素叫做leftPanel始終跟着。HTML/CSS:一直有浮動元素

我不想指定高度。

我該怎麼做?

例子:

|floated element |  main content here 
|floated   |  text is here and the 
| stops   |  floated content <- 
| here   |  keeps following until 
|    |  main content also ends 
|    |  main content here 
|    |  main content here 
|    |  main content here 
|    |  main content here 
|    |  main content here 
|    |  main content here 
|    |  ends here, and it also ends here. 

目前,它看起來像這樣:

|floated element |  main content here 
    |stops   |  main content here 
    |here   |  main content here 
main content here 
main content here 

http://jsfiddle.net/my5Aj/

怎樣纔可以解決嗎?

回答

0

只要把正確的內容放在它自己的div中,設置它的widthfloat: right;

0

給主要內容浮動元素寬度的左邊緣。