当前位置: 首页 > 知识库问答 >
问题:

如何在div[副本]中隐藏滚动条

松雅健
2023-03-14

我已经做了一个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>

共有1个答案

范翰池
2023-03-14

您可以通过对滚动条应用display:none来隐藏滚动条。在CSS下面试试。

CSS:

::-webkit-scrollbar { 
    display: none; 
}

JSFiddle:https://jsfidle.net/nikdtu/arn77mt1/

 类似资料:
  • 目前,我正在使用以下代码显示滚动条: 使用此CSS时,滚动条始终可见,这意味着即使div中的内容没有溢出。 当内容符合提到的高度时,我如何隐藏它们?

  • 我想打印我的html页面到一个PDF文件,但不想滚动条显示在那里的PDF文件。和我的页面有一个可滚动的主体,所以如果我设置如下: 在最终的pdf文件中,正文将是不完整的。那么,如果有一种方法,只是阻止滚动条显示,但内容仍然是可滚动的?

  • 我有一个幻灯片,有一个高度设置为自动,所以任何高度图像都可以显示。在幻灯片中,我有两个箭头,它们被包装在一个具有.center类的div中。箭头是在一个固定的位置,所以当滚动箭头会跟随。当您在div.center上滚动时,分配给div=“center”的函数将显示。 我遇到的问题是,当我滚动过幻灯片放映时,箭头仍然存在。但当我滚动通过我的幻灯片放映div时,箭头是隐藏的。 我如何设置我的脚本,当我

  • 我遇到了麻烦,试图隐藏滚动条对某些div。我在论坛上找到了一些解决方案,但它们从来不符合我的情况,所以我仍然在努力解决这个问题。我的问题:我试图隐藏滚动条在一个div嵌套在另一个div的非固定大小。(它们设置为身体的100%)。 以下是HTML: 和CSS: 此处提供代码本 我希望#event-list和#event-details没有滚动条,但仍然是可滚动的。如果你有什么想法(CSS?JS?jQ

  • CSS: 也就是立场:绝对;使它不同于其他类似的问题,我觉得。目前我可以隐藏滚动条,但当我调整浏览器窗口的大小时,你可以看到部分滚动条伸出来。

  • 以下是我的html代码: