"."/> ".">

Home >Web Front-end >Front-end Q&A >How to set div horizontal scroll bar not to display in html

How to set div horizontal scroll bar not to display in html

WBOY
WBOYOriginal
2022-01-18 14:50:444489browse

In HTML, you can use the style and "overflow-x" attributes to set the div to move horizontally and not display the scroll bar. When the value of the attribute is set to "hidden", the horizontal scrolling mechanism will not be provided. The syntax is: "

".

How to set div horizontal scroll bar not to display in html

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

htmlHow to set the div horizontal scroll bar not to display

The overflow-x attribute specifies whether to clip the left/if it overflows the content area of ​​the element Right margin content.

The syntax is:

overflow-x: visible|hidden|scroll|auto|no-display|no-content;

The parameters are expressed as follows:

How to set div horizontal scroll bar not to display in html

The example is as follows:

<html>
<head>
<meta charset="utf-8"> 
<title>123</title> 
<style> 
div
{
width:110px;
height:110px;
border:thin solid black;
overflow-y:hidden;
}
</style>
</head>
<body>
<div style="overflow-x:hidden;"><p style="width:140px">
In my younger and more vulnerable years my father gave me some advice that I&#39;ve been turning over in my mind ever since.
&#39;Whenever you feel like criticizing anyone,&#39; he told me, &#39;just remember that all the people in this world haven&#39;t had the advantages that you&#39;ve had.&#39; 
</p></div>
<p>Overflow-x指定是否要剪辑的左/右边缘的内容.</p>
<p>Overflow-y指定是否要剪辑的顶部/底部边缘的内容</p>
</body>
</html>

When When the style="overflow-x:hidden;" is not added to the div element, the output result is as follows:

How to set div horizontal scroll bar not to display in html

The above example adds this style, and the output result is as follows :

How to set div horizontal scroll bar not to display in html

Recommended tutorial: "html video tutorial"

The above is the detailed content of How to set div horizontal scroll bar not to display in html. 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