jQuery的CSS()方法
下面的代码可以为div一次性设置多个样式属性
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>css3</title>
<script src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#AB").css({
color:"red",
fontSize:"16px",
fontWeight:"bold"
});
});
</script>
</head>
<body>
<div id="AB">00H5</div>
</body>
</html>
当然也可以单个设置CSS样式如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS</title>
<script src="js/jquery-1.9.1.min.js"></script>
<script type="text/Javascript">
$(document).ready(function(){
$("#AB").css("color","red");
});
</script>
</head>
<body>
<div id="AB">00H5</div>
</body>
</html>
新闻热点
疑难解答