首页 > Web开发 > 详细

css中style和class的加载顺序示例介绍

时间:2016-01-02 19:48:58      阅读:383      评论:0      收藏:0      [点我收藏+]

复制代码
代码如下:

<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
<meta name="author" content="Administrator" />
<!-- Date: 2013-10-09 -->
<style type="text/css" media="screen">
.aa{
cursor: wait;
color: #f00;
}
</style>
<script type="text/javascript">
function clickD(obj){
//obj.style.color = "#f00";
//obj.style.cursor = "wait";
obj.className = "aa";
}
</script>
</head>
<body>
<div onclick="clickD(this)" style="cursor: pointer">点击了试一下</div>
</body>
</html>

这样的写法,不会覆盖style的cursor属性,以style中的属性为最后结果!

用注释中的写法,会覆盖掉style的属性!

css中style和class的加载顺序示例介绍

原文:http://www.jb51.net/css/109035.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!