Home > Web Front-end > Front-end Q&A > How to prevent scroll bars from appearing in css body

How to prevent scroll bars from appearing in css body

藏色散人
Release: 2023-01-04 09:38:18
Original
2828 people have browsed it

How to achieve no scroll bar in css body: first open the corresponding HTML page; then set the style to "body::-webkit-scrollbar{display: none;}" in the chrome browser.

How to prevent scroll bars from appearing in css body

The operating environment of this tutorial: Dell G3 computer, Windows7 system, Chrome76.0&&CSS3 version.

Recommended: "css video tutorial"

css prevents scroll bars from appearing on the body

mentioned hiding scroll bars, The first thing we think of is overflow: hidden, but after setting it like this, the page cannot be scrolled. To allow the body to hide the scroll bar and still scroll, we can use the pseudo element::scrollbar. In the Chrome browser, it can be set like this:

body::-webkit-scrollbar{
    display: none;
}
Copy after login

The effect is as follows, the scroll bar is hidden, and the page can continue to scroll.

How to prevent scroll bars from appearing in css body

The above is the detailed content of How to prevent scroll bars from appearing in css body. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template