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

How to prevent scroll bars from appearing in css body

藏色散人
藏色散人Original
2020-12-30 09:19:242780browse

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;
}

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!

Statement:
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