Home > Article > Web Front-end > How to cancel the scroll bar in html
htmlHow to cancel the scroll bar: 1. Remove the horizontal scroll bar through "overflow-x: hidden"; 2. Remove the vertical scroll bar through "overflow-y: hidden"; 3. Remove the vertical scroll bar through "overflow: hidden" cancels all scroll bars.
The operating environment of this article: windows7 system, HTML5&&CSS3 version, DELL G3 computer
#How to remove the scroll bar on the right side of the browser in html
<body style="overflow-x: hidden"> 表示去掉水平滚动条。 <body style="overflow-y: hidden"> 表示去掉竖直滚动条。 <body style="overflow-x:hidden;overflow-y:scroll"> 表示隐藏横向滚动条,显示纵向滚动条。 <body style="overflow:hidden">或者是<body scroll="no"> 表示全部隐藏
If it is a frame page and it still cannot be removed using the above method, you can consider the following methods:
<style>html { overflow-x:hidden; }</style> 如果想隐藏水平滚动条。 <style>html { overflow-y:hidden; }</style> 如果想隐藏垂直滚动条。 body{style="overflow-y : auto;height"} body浏览器自带的默认值。
Let’s talk about the attribute code of the scroll bar first:
overflow-y : visible | auto | hidden | scroll
visible: Does not cut content or add scroll bars.
auto: Cut content and add scrollbars when needed.
hidden: Do not display content that exceeds the height of the object. This attribute will not be introduced here. If you like it, you can try it yourself.
scroll: Always display a vertical scroll bar.
Let’s talk about the beautification of the scroll bar:
SCROLLBAR-FACE-COLOR: 这是颜色代码,也可以自定义颜色。 SCROLLBAR-HIGHLIGHT-COLOR: 这是颜色代码,也可以自定义颜色。 SCROLLBAR-SHADOW-COLOR: 这是颜色代码,也可以自定义颜色。 SCROLLBAR-3DLIGHT-COLOR: 这是颜色代码,也可以自定义颜色。 SCROLLBAR-ARROW-COLOR: 这是颜色代码,也可以自定义颜色。 SCROLLBAR-TRACK-COLOR: 这是颜色代码,也可以自定义颜色。 SCROLLBAR-DARKSHADOW-COLOR: 这是颜色代码,也可以自定义颜色。 scrollbar-base-color:其实就是上面7个属性的总合,前面的7个属性都可以不用设置了,滚动条会自动帮你设定
, but this setting will be automatically set based on the color of the scrollbar-base-color you set.
Note: If scrollbar-base-color is set, do not set the other seven attributes. If the other seven attributes are set, do not set scrollbar-base-
color, otherwise There may be conflicts between them, and some effects may not work.
Recommended study: "HTML Video Tutorial"
The above is the detailed content of How to cancel the scroll bar in html. For more information, please follow other related articles on the PHP Chinese website!