Home > Article > Web Front-end > How to hide the scroll bar in html
htmlHow to hide the scroll bar: First create an HTML sample file; then set the content area in the body, and put a p outside the content area; finally set the style of p to "overflow:hidden" that is Can.
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, DELL G3 computer
HTML hides the scroll bar and has a scrolling effect
When no scroll bar appears, the width of the header and the content area are equal, but there is too much content in the content area, so the scrolling effect must be retained without the scroll bar appearing. .
Put a p in the outer layer of the content area, set the overflow:hidden style of p, and set the width of the content area to "100% 20px";
<p style="width:400px;height:400px;border:1px solid gray"> <p style="height:40px;line-height:40px;background-color:yellow;text-align:center">头部</p> <p style="height:360px;width:400px;overflow:hidden"> <!-- 内层带滚动效果的p,宽度比父级p宽20px,滚动条被父p隐藏了 --> <p style ="height:360px;width:420px;background-color:green;overflow-y:scroll"> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> <p style="border-bottom:1px solid gray">哈哈哈</p> </p> </p> </p>
Recommended study: "HTML Video Tutorial"
The above is the detailed content of How to hide the scroll bar in html. For more information, please follow other related articles on the PHP Chinese website!