How to disable horizontal scrolling in html

青灯夜游
Release: 2021-12-13 16:46:18
Original
5305 people have browsed it

In HTML, you can use the overflow-x attribute to prohibit horizontal scrolling. You only need to add the "overflow-x:hidden;" style to the body element; this style can stipulate that when the content exceeds the page horizontally, No horizontal scrolling mechanism is provided, but overflowing content is cropped and hidden.

How to disable horizontal scrolling in html

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

In HTML, you can use the overflow-x attribute to disable horizontal scrolling. As shown below:

How to disable horizontal scrolling in html

Description:

The overflow-x attribute specifies whether to crop the left/right edge of the content - if it overflows the element content area. When the value of this attribute is hidden, the content is clipped - no scrolling mechanism is provided.

Attribute value of overflow-x attribute:

##visible Content is not cropped and may appear outside the content box. hiddenCrop content - No scrolling mechanism is provided. scrollCrop content - Provides scrolling mechanism. autoA scrolling mechanism should be provided if the box overflows. no-displayIf the content does not fit into the content box, delete the entire box. no-contentHide the entire content if it does not fit into the content box.
value description
Recommended tutorial: "

html video tutorial"

The above is the detailed content of How to disable horizontal scrolling in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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