是否有一种方法永远不会在div上有一个滚动条?

时间:2022-09-11 20:35:54

I have a div that, depending on circumstances, can overflow. Is there a way so that, no matter how much data is in the div, it will not have a scroll bar? I was hoping that there would be a style I could just add like:

我有一个div,根据情况,它可以溢出。是否有一种方法,使它无论div中有多少数据,都不会有一个滚动条?我希望能有一种我可以加上的风格:

<div style="width:100; height:100; noscroll:true" >

< div风格= "宽度:100;身高:100;noscroll:真正的“>

Is there such a thing?

有这样的事吗?

1 个解决方案

#1


6  

Yes, you can use overflow: hidden; and it will never show a scroll bar. Note that this might also disable scrolling (even with mouse wheel) in some browsers.

是的,可以使用overflow: hidden;它永远不会显示滚动条。注意,这也可能在某些浏览器中禁用滚动(甚至是鼠标滚轮)。

You can specify overflow-x: hidden; for horizontal or overflow-y: hidden; for vertical scrollbars.

可以指定overflow-x: hidden;为水平或溢出-y:隐藏;垂直滚动条。

#1


6  

Yes, you can use overflow: hidden; and it will never show a scroll bar. Note that this might also disable scrolling (even with mouse wheel) in some browsers.

是的,可以使用overflow: hidden;它永远不会显示滚动条。注意,这也可能在某些浏览器中禁用滚动(甚至是鼠标滚轮)。

You can specify overflow-x: hidden; for horizontal or overflow-y: hidden; for vertical scrollbars.

可以指定overflow-x: hidden;为水平或溢出-y:隐藏;垂直滚动条。