2016-09-14 279 views
0

我想要顯示水平滾動條。我用overflow-x:scroll;但我沒有看到任何水平滾動條。請幫忙。水平滾動條丟失

<div class="abc"> 
    <p>This is overflow-x scroll. This is overflow-x scroll. This is overflow-x scroll.</p> 
</div> 
.abc{ 
    overflow-x:scroll; 
    width:1000px; 
} 

我的代碼在這裏是here

+0

請將代碼添加到這個問題。您也可以在問題中保留jsbin。將代碼添加到代碼塊中的原因是萬一jsbin鏈接將來會中斷,問題仍然可以幫助未來的用戶。 – Lexi

+0

這是一個志願者網站。不要打電話給別人姓名,也不要期待幫助。他們基於問題的質量進行投票。看[這裏](http://stackoverflow.com/help/how-to-ask) – Lexi

回答

0

在你的例子中,你應該設置白色空間值nowrap在你的內部股利。

看看在html:

<!DOCTYPE html> 
<html> 
    <head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width"> 
    <title>JS Bin</title> 
    </head> 
    <body> 
    <div class="a"> 
     <div class="scrollviewer"> 
      <p class="datacontainer">This is overflow-x scroll. This is overflow-x scroll. 
      <br/> 
      This is overflow-x scroll.This is overflow-x scroll.This is overflow-x scroll.This is overflow-x scroll.This is overflow-x scroll.This is overflow-x scroll.This is overflow-x scroll.This is overflow-x scroll.</p> 
     </div> 
    </div> 
    </body> 
</html> 

和CSS:

.scrollviewer{ 
    overflow-x: scroll; 
    width:100%; 
} 
.datacontainer{ 
    white-space: nowrap; 
}