HTML,CSS - 禁用在正文滚动 [英] HTML, CSS - Disable Scrolling on Body

查看:145
本文介绍了HTML,CSS - 禁用在正文滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想完全停用HTML 正文的滚动功能。我尝试了以下选项:

I would like to disable scrolling on the HTML body completely. I have tried the following options:


  • overflow:hidden; 不工作,没有禁用滚动,它只是隐藏滚动条)

  • overflow: hidden; (not working, did not disable scrolling, it just hid the scrollbar)

position:fixed; 这个工作,但它完全滚动到顶部,这是不能接受的这个特定的应用程序)

position: fixed; (this worked, but it scrolled completely to the top, which is unacceptable for this specific application)

推荐答案

设置 height 溢出

html, body {margin: 0; height: 100%; overflow: hidden}

http://jsfiddle.net/q99hvawt/

这篇关于HTML,CSS - 禁用在正文滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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