如何在div中隐藏滚动条[重复]
Posted
技术标签:
【中文标题】如何在div中隐藏滚动条[重复]【英文标题】:How to hide scrollbar in a div [duplicate] 【发布时间】:2017-05-29 18:50:09 【问题描述】:我制作了一个 div,它包含了可滚动的溢出内容,但我希望隐藏它的滚动,但 div 仍然可以滚动。
.description
height: 150px;
overflow: scroll;
<div class="description">
<h4>Description</h4>
<p>After a series of deadly discoveries, Bruce Wayne has learned that the Court of Owls is real � and a deadly threat out to control Gotham City! Unleashing their deadly assassins known as the Talons, Batman must stop the insidious Court of Owls before they claim the city for their own. In doing so, The Dark Knight will uncover dark secrets � not just about the city he�s sworn to protect, but about the history of the Wayne family.After a series of deadly discoveries, Bruce Wayne has learned that the Court of Owls is real � and a deadly threat out to control Gotham City! Unleashing their deadly assassins known as the Talons, Batman must stop the insidious Court of Owls before they claim the city for their own. In doing so, The Dark Knight will uncover dark secrets � not just about the city he�s sworn to protect, but about the history of the Wayne family.After a series of deadly discoveries, Bruce Wayne has learned that the Court of Owls is real � and a deadly threat out to control Gotham City! Unleashing their deadly assassins known as the Talons, Batman must stop the insidious Court of Owls before they claim the city for their own. In doing so, The Dark Knight will uncover dark secrets � not just about the city he�s sworn to protect, but about the history of the Wayne family.</p>
</div>
【问题讨论】:
你可以这样做jsfiddle.net/Lg0wyt9u/1438,我在mozilla上测试过 【参考方案1】:您可以通过应用适用于所有不同浏览器的 3 行 CSS 来隐藏滚动条。试试下面的 CSS。 [更新]
CSS:
.classname
height: 150px;
overflow: scroll;
-ms-overflow-style: none;
/* for Internet Explorer, Edge */
scrollbar-width: none;
/* for Firefox */
.classname::-webkit-scrollbar
display: none;
/* for Chrome, Safari, and Opera */
JSFiddle : https://jsfiddle.net/xet3r59k/3/
【讨论】:
你能告诉我在 MOZILLA 或 IE 等其他浏览器中同样可以正常工作吗? 你试过this吗? 这不适用于除 chrome 之外的任何其他浏览器以上是关于如何在div中隐藏滚动条[重复]的主要内容,如果未能解决你的问题,请参考以下文章