强制浏览器显示滚动条的CSS [英] CSS for forcing the browser to display scrollbar

查看:408
本文介绍了强制浏览器显示滚动条的CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个Web应用程序,发现当我调整页面大小时,浏览器不会显示它自己的滚动条,因为窗口收缩。这将阻止用户访问内容。我将我的身体宽度设置为500px,并将导航栏设置为 white-space:nowrap 。如何让浏览器识别出屏幕右侧有内容?



为了说明我想要浏览器的滚动条,而不是任何控件上的滚动条。

解决方案

您可以根据是要添加水平,垂直还是两个滚动条来使用以下选项之一: p>

  body {overflow-x:scroll;} 
body {overflow-y:scroll;}
body {但是,我认为如果你在一个部分中显示内容,然后做

/ p>

 #id-of_your_div {overflow:scroll;} 

因此,您添加滚动到div,而不是强制浏览器显示滚动条,那么您的页面将提供更好的用户体验,因为这样的滚动条更容易为用户访问。 / p>

I've written a web application and found that when I resize the page, the browser doesn't display it's own scrollbar as the window shrinks. This prevents the user from accessing content. I've set my body width to 500px and set the navbar to white-space:nowrap. How can I get the browser to recognize that there is content to the right of the screen?

Just to clarify I want the browser's scrollbar and not a scroll bar on any control.

解决方案

You can use one of the following depending on whether you want horizontal, vertical, or both scrollbars to be added:

body    {overflow-x:scroll;}
body    {overflow-y:scroll;}
body    {overflow:scroll;}

However, I think if you show the content in a section and then do

#id-of_your_div {overflow:scroll;}

So that you add scroll to the div rather than force the browser to show scrollbars, then your page will provide a much better user experience since such scrollbars are easier for users to access.

这篇关于强制浏览器显示滚动条的CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆