您的位置:首页 > 其它

保护眼睛,开启浏览器的夜间模式 顺便学下!important的作用

2013-07-30 15:15 357 查看
打开笔记本程序,复制以下代码


*{background-image: none !important;
background: none !important;
background:#333333 !important;
color:#888888!important;
border-color:#555555 !important;
scrollbar-arrow-color:#CCCCCC !important;
scrollbar-base-color:#2266AA !important;
scrollbar-shadow-color:#2266AA !important;
scrollbar-face-color:#333333 !important;
scrollbar-highlight-color:#2266AA !important;
scrollbar-dark-shadow-color:#2266AA !important;
scrollbar-3d-light-color:#2266AA !important;
scrollbar-track-color:#333333 !important;}
a,a *{color:#88AADD !important;
text-decoration:none !important;}
a:visited,a:visited *,a:active,a:active *{color:#5588AA !important;}
a:hover,a:hover *{color:#AADD88 !important;
background:#666666 !important;}input,select,option,button,textarea{color:#AAAAAA !important;
background:#555555 !important;
border:#666666 !important;
border-color: #666666 #888888 #888888 #666666 !important;}input:focus,select:focus,option:focus,button:focus,textarea:focus,input:hover,
select:hover,option:hover,button:hover,textarea:hover {color:#BBBBBB !important;
background:#5A5A5A !important;
border-color: #777777 #999999 #999999 #777777 !important;}
input[type=button],input[type=submit],input[type=reset],input[type=image] {border-color: #888888 #666666 #666666 #888888 !important;}input[type=button]:focus,
input[type=submit]:focus,input[type=reset]:focus,input[type=image]:focus, input[type=button]:hover,input[type=submit]:hover,input[type=reset]:hover,input[type=image]:hover {
color:#BBBBBB !important;
background:#666666 !important;
border-color: #AAAAAA #888888 #888888 #AAAAAA !important;}


文件→另存为 文件名输入 黑色.css,保存类型选择“所有文件”→保存。
打开internet选项,点击“辅助功能”,使用用户样式表→浏览刚才保存的css文件位置并选择,点确定即可。

下面是操作过程:

有图片为证哦。

步骤一:在浏览器中,找到“工具”->“Internet选项”

#box
  {
   width:150px;        //这个是错误的width,所有浏览器都读到了
   voice-family: \}\;      //IE5.X/win忽略了\}\后的内容
   voice-family:inherit;
   width:100px;       //包括IE6/win在内的部分浏览器读到这句,新的数值(300px)覆盖掉了旧的
  }
还有更简单的办法如下:
  CSS:
  #box { width:150px; }
  #box div { border:5px; padding:20px; }
  HTML:
  ...


View Code
这样一来在任何浏览器中盒的总宽度都将是150像素。

  但是即使是到了最新的IE6.0依然存在浮动模型(Float-model)的问题,值得庆幸(还是悲哀?)的是我们可以用IE中一直都不支持的!important来解决这个问题。
  !important是CSS1就定义的语法,作用是提高指定样式规则的应用优先权(参见:W3.org的解释)。语法格式{ sRule!important },即写在定义的最后面,

例如:

box{color:red !important;}


假如我们定义一个这样的样式:

#box{background-color: #ffffff !important; background-color: #000000;}


那么在支持该语法的浏览器,如Firefox、Opera中,能够理解!important的优先级,背景显示#ffffff颜色,而在IE中则显示#000000.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: