行内样式
<!DOCTYPE html><html lang="zh-CN"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum=1.0, user-scalable=no"> <title>行内样式</title></head><body> <!-- width:宽度 height:高度 background-color:背景颜色 --> <div style="width: 100%; height: 100px; background-color: red;"></div></body></html>

内部样式
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum=1.0, user-scalable=no">
<title>内部样式</title>
<style>
div {
width: 100%;
height: 100px;
background-color: skyblue;
}
</style>
</head>
<body>
<div></div>
</body>
</html>

外部样式
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum=1.0, user-scalable=no">
<title>外部样式</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div></div>
</body>
</html>
div {
width: 100%;
height: 100px;
background-color: greenyellow;
}
