div边框的问题

zhrybd111 2012-12-17 10:32:42
有CSS(ind.css):
#a1
{
border:1px solid red !important;
border:3px dotted green;
}

有HTML(index.html)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<title>新建网页</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />

<link href='ind.css' type='text/css' rel='stylesheet' />

<script type="text/javascript">
</script>
<style type="text/css">
div
{
width:100px;
height:100px;
}
</style>


</head>


<body>
<div id="a1"></div>
</body>
</html>

在火狐浏览器重可以看到该div的边框是1px solid red 的,没问题,可是在IE浏览器中看,该div的边框还是1px solid red 的,并没有变成3px dotted green的,这是为什么,在写CSS时在后面加了!important啊;
而且在别人的计算机上试,同样的程序,火狐浏览器和IE浏览器上该div的边框就有不同的显示,完全正确。
这个该如何修改啊
...全文
150 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhrybd111 2012-12-17
  • 打赏
  • 举报
回复
我的IE的版本是IE8,版本:8.0.7600.16385 64-bit edition, 请问如果我需要针对火狐浏览器和IE浏览器设置不同的CSS属性,根据我当前的这个IE版本,我应该怎么做,如果在CSS中设置属性时加!important不可以的话,到底应该如何设置
oggmm 2012-12-17
  • 打赏
  • 举报
回复
看 About Internet Explorer 菜单
zhrybd111 2012-12-17
  • 打赏
  • 举报
回复
应该如何看IE浏览器的版本啊,我的机上装的是win7家庭版
oggmm 2012-12-17
  • 打赏
  • 举报
回复
这要看IE浏览器的版本 比如IE6不支持important 那么就按后面那个显示 支持important的就显示important那个定义
含蓄的坏 2012-12-17
  • 打赏
  • 举报
回复
应该和你的IE版本有关系……
001007009 2012-12-17
  • 打赏
  • 举报
回复
可见 以上情况,写在同一选择器中的!important是不被IE6所认的,而分开则正常
001007009 2012-12-17
  • 打赏
  • 举报
回复
IE6到底支持!important吗 -------- 不支持的情况.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>IE6支持important吗</title>
<style type="text/css">
.box { background:green !important; background:red;}
</style>
</head>
<body>
<div class="box">IE6不支持的!important</div>
</body>
</html>
支持的情况.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>IE6支持important吗</title>
<style type="text/css">
.box { background:green !important; }
.box { background:red;}
</style>
</head>
<body>
<div class="box">IE6支持的!important</div>
</body>
</html>
luodawn 2012-12-17
  • 打赏
  • 举报
回复
我试过了也和楼主的一样,找了些HACK也不行,共求答案!

61,112

社区成员

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

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