<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>DOM-CSS</title>
<style>
div{
font-size: 50px;
color: red;
}
</style>
</head>
<body>
<div>helloworld</div>
<script type="text/javascript">
</script>
</body>
</html>
首先这是我们普通的定义CSS的方式,我们来看看效果
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>DOM-CSS</title>
</head>
<body>
<div id="a">helloworld</div>
<script type="text/javascript">
var a=document.getElementById("a");
a.style.color="blue";
a.style.fontSize="50px";
</script>
</body>
</html>