为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

How to hide or disable vertical and horizontal scrollbars?

  • 6 个回答
  • 18 人有此问题
  • 684 次查看
  • 最后回复者为 cor-el

more options

I would like to hide or disable the vertical and horizontal scrollbars from the Firefox (20.0.1 at the moment) window, is there any CSS rule or setting in "about:config" resource to get this behaviour?

Thanks in advance.

I would like to hide or disable the vertical and horizontal scrollbars from the Firefox (20.0.1 at the moment) window, is there any CSS rule or setting in "about:config" resource to get this behaviour? Thanks in advance.

被采纳的解决方案

The above posted code should still be working.

Make sure that you have placed the userChrome.css file in the chrome folder in the Firefox profile folder.
This chrome folder doesn't exist by default and needs to be created.


@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */

#content browser {
 margin-right: -14px !important;
 overflow-y: scroll;
 overflow-x: hidden;
}
定位到答案原位置 👍 2

所有回复 (6)

more options

You can hide scroll bars with an overflow:hidden rule, but if you would hide scroll bars then you may not be able to scroll the browser window anymore.

You can try code like this in userChrome.css and adjust the margin-right:

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */

#content browser{margin-right:-14px!important;overflow-y:scroll;overflow-x:hidden;}

Add code to the userChrome.css file below the default @namespace line.

The customization files userChrome.css (interface) and userContent.css (websites) are located in the chrome folder in the user profile folder.

more options

It works great, gives exactly the results I was looking for! Thanks again!

Tested on Firefox v.20.0.1 running on ArchLinux x86_64 GNU/Linux.

CSS code written in '~/.mozilla/firefox/<alphanumeric-profile>/chrome/userChrome.css', don't forget to restart Firefox after editing/creating the files/folders.

more options

This solution does not work in v.23.0. I put this style in

~/.mozilla/firefox/eyrf55gp.default/

which I determined was the active profile based on its timestamp. The scrollbars are still there.

I am running gentoo, so can patch firefox easily. Is there a feature in the code that will allow me to dispose of scrollbars entirely? I never use them for scrolling. I wouldn't mind one scrollbar show in the active window as an indicator while it is scrolling (like in safari), but otherwise scrollbars are just a waste of space and a huge clutter factor.

more options

选择的解决方案

The above posted code should still be working.

Make sure that you have placed the userChrome.css file in the chrome folder in the Firefox profile folder.
This chrome folder doesn't exist by default and needs to be created.


@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */

#content browser {
 margin-right: -14px !important;
 overflow-y: scroll;
 overflow-x: hidden;
}
more options

It works. Beautiful.

The scrollbars have not completely disappeared, but they are now squashed to four pixels wide (including the window border) and the indicator bar itself is just one pixel wide. Not exactly how I wanted it, but good enough.

The reason I was unable to get it to work following the instructions (including the above KB article) is that my profile folder is not .mozilla. I had to hunt it down and then create the chrome folder in it. Here's what my folder structure is (with a lot of stuff omitted):

.mozilla/
├── appreg
├── eclipse
├── extensions
├── firefox
│   ├── 5q0epjhm.default
│   ├── Crash Reports
│   ├── a459vpi6.default
│   ├── eyrf55gp.default
│   │   ├── Cache
│   │   ├── _CACHE_CLEAN_
│   │   ├── adblockplus
│   │   ├── addons.sqlite
│   │   ├── addons.sqlite-journal
│   │   ├── blocklist.xml
│   │   ├── bookmarkbackups
│   │   ├── cert8.db
│   │   ├── cert_override.txt
│   │   ├── chrome
│   │   │   └── userChrome.css
│   │   └── xpti.dat
│   ├── pluginreg.dat
│   └── profiles.ini
├── pluginreg.dat
└── plugins

The chrome folder was not there; I cerated it following cor-el's advice.

I could tell which of the hash-coded profiles was active by checking the access timestamps on them. Also, there is the profile.ini file containing a reference to it:

[General]
StartWithLastProfile=1

[Profile0]
Name=default
IsRelative=1
Path=eyrf55gp.default

I don't know why my profile layout does not match its description in the docs, but so it is.

more options

This is the normal layout for the Firefox profiles.

You seem to have two other profile folders (5q0epjhm.default and a459vpi6.default), probably from older Firefox versions.
You can probably remove the pluginreg.dat files apart from the one in the current Firefox profile folder.

I don't know if the Cache folder in the current Firefox profile folder is still in use. Current Firefox versions have the cache folder in ~/.cache/mozilla/firefox (you can check the location on the about:cache page).