Skip to main content

内部样式表

内部样式表 internal style sheet

<!DOCTYPE html>
<html lang="en">
<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" />
<title>Document</title>
<style>
.title {
margin: 20px 0;
font-size: 24px;
font-weight: 700;
}

.box {
width: 100px;
height: 100px;
background-color: #ccc;
}
</style>
</head>

<body>
<div class="title">我是标题</div>
<div class="box">我是盒子</div>
</body>
</html>
  • 内部样式表(internal style sheet)

    • 将 CSS 放在 HTML 文件 <head> 元素里的 <style> 元素之中。
  • 在 Vue 的开发过程中,每个组件也会有一个 style 元素,和内部样式表非常的相似(原理并不相同)