2012-11-20 36 views
0

有沒有改變一個div的默認行爲,使溢出:隱藏導致內容溢出一個div的右側,而不是出底部的div?div overflow right

+1

看看如何在CSS中使用overflow-x和overflow-y。 –

+0

@Diodeus這些屬性與他的問題無關。 –

回答

3

嘗試white-space:nowrap。這樣內容將不會換行到新行。

div{ 
    overflow:hidden; 
    white-space:nowrap; 
    width:100px; 
} 
+1

啊,謝謝!正是我需要的。非常感謝。 (因爲我沒有足夠的聲望,我還不能投票。) – Ryan

2

是的。有文字不換行:

<div style="width:100px;height:30px; overflow:hidden; white-space:nowrap;"> 
    Is there away to change the default behavior of a div so that 
    overflow:hidden causes the content to overflow out the right side 
    of a div, rather than out of the bottom of the div? 
</div>