自定义Firefox样式
用CSS定义Firefox浏览器,最大的好处是不用装扩展,从而节省”资源”.
首先是userChrome.css、 userContent.css的存放位置:按下表找到个人文件位置,然后Mozilla文件夹下面会有类似\Firefox\Profiles\ y0g72ech.default\chrome的文件夹——把文件名中的’example’字样去掉,另外你也可以直接建立这2个文件(不用内容就可 以,但是名称不要写错).
| 操作系统 | 个人文件夹地址(s) |
|---|---|
| Windows 2000 and XP/2003 | C:\Documents and Settings\用户目录\ Application Data\Mozilla\ |
| Windows Vista | C:\Users\用户目录\AppData\Roaming\Mozilla\ |
| Unix/Linux | ~/.mozilla/ |
| Mac OS X | ~/Library/Mozilla/ ~/Library/Application Support/ |
我的理解是,userConter.css是定义和网页有关样式,比如google搜索页,空白页,Gmail页……而userchrome.css是定义浏览器面板外观的,2者都通过定义CSS样式来完成,而且最初都可通过手动建立这2个文件,Mozilla.org中关于这两者的说明:
userContent.css in the chrome folder is a CSS
file that you can use to change the way web sites and e-mails look.This file does not exist in a new profile. You can create it manually.
userChrome.css in the chrome folder is a CSS file that can be used to change the way Mozilla applications’ interfaces look.This file does not exist in a new profile. You can create it manually..
我只介绍我觉得非常有必要的几种样式,更多的你可以浏览文章末尾的资料来源,查找更多的内容.
1.修改空白页的背景颜色(userContent.css我只修改了这一项):
突然打开一个空白页有时会觉得刺眼,你可以把它定义成任何你喜欢的颜色(红色部分)…方法:在userContent.css中加入
@-moz-document url(”about:blank”) {
*{ background: none !important; background-color: #5d5d5d !important }
}

2、全屏时显示菜单栏.状态栏.标签栏.地址栏最大化时没有地址栏、标签栏等挺不方便的,可以把以下内容加到userChrome.css:
/* 全屏模式显示菜单栏状态栏 */
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
@-moz-document url(chrome://browser/content/browser.xul) {
#toolbar-menubar[moz-collapsed=true] {visibility:visible !important;}
#status-bar[moz-collapsed=true] {visibility:visible !important;}
#window-controls {display:none !important;}
}

3.菜单栏不显示快捷键如果你已经很熟悉快捷键的话,在userChrome.css加入:
/*菜单栏不显示快捷键.*/
.menu-iconic-accel {
display: none !important;
}
.menu-accel {
display: none !important;
}
4.自动隐藏侧边栏鼠标经过显示,如果你使用侧边栏,并且有时觉得那么快地方被占挺碍眼的,感觉挺好用的,可惜我不习惯用侧边栏,在userChrome.css加入:
/* 自动隐藏侧边栏 */
@-moz-document url(chrome://browser/content/browser.xul) {
#sidebar-box {
margin-left: -215px !important;
/* Set 1px less than the Sidebar width as a negative number */
}
#sidebar-box:hover { margin-left: 0px !important;
}
#sidebar-splitter {
margin-left: -6px !important;
border: none !important;
}
sidebarheader {
height:
5px !important;
}
}
bookmarks-tree, #historyTree {
-moz-appearance: none !important;
margin: 0px 3px 3px 3px !important;
border: 2px solid !important;
-moz-border-top-colors: ThreeDShadow
ThreeDDarkShadow !important;
-moz-border-right-colors: ThreeDHighlight
ThreeDLightShadow !important;
-moz-border-bottom-colors: ThreeDHighlight
ThreeDLightShadow !important;
-moz-border-left-colors: ThreeDShadow
ThreeDDarkShadow !important;
}
.tree-scrollbar {
width: 0px !important;
}
#search-box, #bookmarksPanel label, #sidebar-box .tabs-closebutton,
#sidebar-title,
menuitem[label="Bookmarks"][checked="true"],
menuitem[label="History"][checked="true"] {
display: none !important;
}
上面几项我使用了1.2.3三项,其他的可以去文末的网址查找Userstyles.org有许多样式…….
本文资料来源:Mozillazine.org,Mozine.cn,Userstyles.org
本文地址 : http://xinyoo.net/20070810/%e8%87%aa%e5%ae%9a%e4%b9%89%e8%87%aa%e5%b7%b1%e7%9a%84firefox%e6%a0%b7%e5%bc%8f.html
如果你对本文感兴趣,欢迎订阅我的博客
Leave a Reply