如何仅隐藏网站特定页面的浏览器滚动条
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
相关产品推荐
相关产品推荐

