急!!background:none!important 这个是什么意思??

linlinbaobao 2009-03-16 08:19:41
我在学习CSS的过程中,
遇到了下面的这种用法。
background:none!important

cursor: pointer !important;

想问一下各位高手,这是什么意思??
...全文
4049 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
JianWu910704 2012-07-16
  • 打赏
  • 举报
回复
!important是优先级的意思,会优先使用id或者class定义的类
byp2426091 2012-01-06
  • 打赏
  • 举报
回复
还是没看明白important是指什么
mycjzlove 2010-04-02
  • 打赏
  • 举报
回复
学习了,呵呵
lanseshenying 2009-12-25
  • 打赏
  • 举报
回复
qweqweqwe
legfootgi 2009-12-01
  • 打赏
  • 举报
回复
呵呵~~小弟学习一下~~
wonder888888 2009-03-16
  • 打赏
  • 举报
回复
这是我们开发团队默认的样式表 希望对你有帮助

/*
Author: cuikai msty@tom.com
*/

/* reset */
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0}
table{border-collapse:collapse;border-spacing:0}
fieldset,img{border:0}
address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal}
ol,ul {list-style:none}
caption,th {text-align:left}
h1,h2,h3,h4,h5,h6{font-size:100%}
q:before,q:after{content:''}

/* font */
.f12{font-size:12px!important}
.f14{font-size:14px!important}
.bold{font-weight:bold}
.normal{font-weight:normal}
.font_none{font-size:0px; line-height:0px}

/* color */
.red , .red a{color:#f00!important}
.gray, .gray a {color:#666!important}
.green , .green a {color:#76c56a!important}
.orange, .orange a {color:#fd864a!important}

/*layout*/
.block{display:block}
.hidden{display:none}
.bg_none{background:none!important}
.float_left{float:left}
.float_right{float:right}
.clear{clear:both!important}
.margin_10{margin:10px}
.margin_20{margin:20px}
.margin_top{margin-top:10px}
.margin_right{margin-right:10px}
.margin_bottom{margin-bottom:10px}
.margin_left{margin-left:10px}
.padding_10{padding:10px}
.padding_20{padding:20px}
.padding_top{padding-top:10px}
.padding_right{padding-right:10px}
.padding_bottom{padding-bottom:10px}
.padding_left{padding-left:10px}
.nopadding{padding:0!important}

/*
Author: guoxiaoling
*/

/*
Author: shiwenliang
*/* { margin:0; padding:0;}
html { text-align:center; background:#fff;}
body { width:960px; position:relative; margin:0 auto; padding:10px 0; text-align:left; font:12px/1.6em Tahoma,Verdana, Lucida, Arial, Helvetica, 宋体,sans-serif; color:#666;}
h1, h2, h3, h4, h5, h6 { font-size:100%;}
address, caption, cite, code, dfn, em, strong, th, var,b,i { font-style:normal; font-weight:normal;}
table { border-collapse:collapse; border-spacing:0; empty-cells:show;}
ol, ul { list-style:none outside;}
:focus { outline :0;}
fieldset, img { border:0;}
caption, th { text-align :left;}
q:before, q:after { content:'';}
a { text-decoration:none; }
a:hover { text-decoration:underline;}
input,select,textarea { font-size:12px; padding:2px;}
.clearfix { overflow:hidden; zoom:1;}
wonder888888 2009-03-16
  • 打赏
  • 举报
回复
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<style type="text/css">

span{
visibility: hidden;
}
a{
background:url(http://img1.qq.com/lady/pics/12105/12105393.jpg) no-repeat left top;
width:158px; height:200px;display:block; border:1px solid #FFFFFF; float:right;overflow:hidden;
}
a:active,a:hover{ cursor:pointer}
a:hover span,a:active span{position:absolute;top:0px; z-index:20px; left:0px; visibility: visible;}
img{ width:400px; height:280px; border:7px solid #FFFFFF};
</style>
<body>
<a href="# "><span><img src="a2.jpg" alt="图片说明" /></span></a>

</body>
</html>
实例二:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<style type="text/css">

span{
visibility: hidden;
}
a{
background:url(http://img1.qq.com/lady/pics/12105/12105393.jpg) no-repeat left top;
width:158px; height:200px;display:block; border:1px solid #FFFFFF; float:right;overflow:hidden;
}
a:hover span,a:active span{position:absolute;top:0px; z-index:20px; left:0px; visibility: visible;}
img{ width:400px; height:280px; border:7px solid #FFFFFF};
</style>
<body>
<a href="# "><span><img src="a2.jpg" alt="图片说明" /></span></a>

</body>
</html>

发现只是少了一句: a:active,a:hover{ cursor:pointer};下面的效果就出不来了。
linlinbaobao 2009-03-16
  • 打赏
  • 举报
回复
怎么看不到了?自己顶。
div_css 2009-03-16
  • 打赏
  • 举报
回复
我觉得应该是,使用!important属性的样式,Firefox、Opera等浏览器才会识别他的优先级,而ie中不会识别!important的样式,也就是这两行代码,是过滤ie的吧,个人见解!
xiaohuixiongya 2009-03-16
  • 打赏
  • 举报
回复
应该为的是IE7也会支持:background:none;和cursor:pointer
mike_24 2009-03-16
  • 打赏
  • 举报
回复
[Quote=引用楼主 linlinbaobao 的帖子:]
我在学习CSS的过程中,
遇到了下面的这种用法。
background:none!important

cursor: pointer !important;

想问一下各位高手,这是什么意思??
[/Quote]

为了兼容各种浏览器

background:none!important //for IE7 and FF

但IE6不识别important

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧