简体   繁体   English

隐藏浏览器滚动条

[英]Hide browser scrollbars

If I have two DIV's on my webpage which are larger than a browser window, than I have a horizontal scrollbar in my browser. 如果我的网页上有两个DIV,它们大于浏览器窗口,则我的浏览器中没有水平滚动条。

What should I do to hide this browser scrollbar for the first DIV and not to hide for a second? 我应该怎么做才能为第一个DIV隐藏该浏览器滚动条,而不要隐藏第二个DIV?

Like I have two divs: 200px and 300px width. 就像我有两个div:200px和300px宽度。 I want to hide horizontal scrollbar if my browsersize 201-299 px. 如果我的浏览器大小为201-299像素,我想隐藏水平滚动条。 250px for example. 例如250px。

How could I ban scroll the browser window if the width 201-299? 如果宽度为201-299,如何禁止浏览器窗口滚动?

You could wrap the two <div> s in a wrapper <div> with min-width set to something acceptable to you: 您可以将两个<div>包裹在包装器<div>并且将min-width设置为您可以接受的值:

<style>
div.wrapper {
  min-width: 300px;
}

div.content {
 width: 250px;
}
</style>

<div class="wrapper">
  <div class="content>
  ...
  </div>
  <div class="content>
  ...
  </div>
</div>

This way, the browser will show scrollbars for the wrapper div, but not on the content divs. 这样,浏览器将显示包装div的滚动条,而不显示内容div的滚动条。 Is that what you are looking for? 那是您要找的东西吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM