Home > Web Front-end > Front-end Q&A > How to disable scroll bars in css

How to disable scroll bars in css

藏色散人
Release: 2023-01-04 09:34:10
Original
6181 people have browsed it

How to disable scroll bars in css: 1. Add "scroll="no"" to to hide the scroll bars; 2. Set "<boby scroll="auto">" to hide the scroll bars when not needed ;3. Hide the scroll bar through the overflow attribute.

How to disable scroll bars in css

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, DELL G3 computer

CSS disable scroll bar

CSS disables scroll bars. There are 4 methods, as follows:

1. Completely hide

Add scroll="no" in , the scroll bar can be hidden;

<boby scroll="no">
Copy after login

2. Hide when not needed

means that when the width or height of the browser window is greater than the width or height of the page, the scroll bar will not be displayed;

Otherwise, it will be displayed;

<boby scroll="auto">
Copy after login

3. Style sheet method (this is easier to use)

Add style="overflow-x:hidden" to , you can Hide the horizontal scroll bar;

Add style="overflow-y:hidden" to hide the vertical scroll bar.

Add

<style>
html { overflow-x:hidden; }
</style>
Copy after login

4 to the included page 4. Another method

<style type="text/css">
body {
overflow-x:hidden;
overflow-y:hidden;
}
</style>
<style type="text/css">
html {
overflow-x:hidden;
overflow-y:hidden;
}
</style>
Copy after login

Recommended learning: "css video tutorial"

The above is the detailed content of How to disable scroll bars in css. 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