You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何仅隐藏网站特定页面的浏览器滚动条

Hide Scrollbar Only on a Specific Page

Your current CSS targets the body element globally, which is why it hides scrollbars across your entire site. To restrict this to just one page, follow these steps:

  • Add a unique class to the <body> tag of the page where you want to hide the scrollbar. For example:

    <body class="hide-scrollbar">
    
  • Update your CSS to target only the body with that class, and include cross-browser support for better compatibility:

    /* Hide scrollbar for WebKit browsers (Chrome, Safari, Edge) */
    .hide-scrollbar::-webkit-scrollbar {
        display: none;
    }
    
    /* Hide scrollbar for IE and Edge */
    .hide-scrollbar {
        -ms-overflow-style: none;
    }
    
    /* Hide scrollbar for Firefox */
    .hide-scrollbar {
        scrollbar-width: none;
    }
    

If the scrolling on your target page is contained within a specific div (not the body), apply the class to that container instead and adjust the selector accordingly.

内容的提问来源于stack exchange,提问作者matt

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.14 01:15:45