<head>
<title></title>
<style>
/* 这里写css */
</style>
<head>
<!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>
p {
/* 文字颜色设置为红色 */
color: red;
/* 字体大小设置为30像素 */
font-size: 30px;
/* 背景颜色 */
background-color: #bfa;
/* 设置宽度和高度 */
width: 600px;
height: 100px;
line-height: 100px;
text-align: center;
}
</style>
</head>
<body>
<p>p段落里的文字</p>
</body>
</html>
<div style="color: green; background-color: #f1f1f1;">
这是一段设置了css样式的文字
</div>
标签名 {
属性名:属性值;
}
<style>
p {
color: red;
}
</style>
<p>你好,世界</p>
<style>
.red {
color: red;
}
.size {
font-size: 60px;
}
</style>
<div class="red">你好,世界</div>
<div class="red size">你好,世界</div>
<style>
#name {
color: green;
}
</style>
<div id="name">你好,世界</div>
/* 清除内外边距 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}