2016-09-14 201 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; 
}