1.当前元素
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>css元素样式来源-当前元素的属性</title>
</head>
<body>
<h1 style="color: darkgreen">我要学会PHP语言,开发小程序</h1>
</body>
</html>
2.当前文档
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>css元素样式来源-当前文档</title>
<style>
h1 {
color: darkgreen;
}
</style>
</head>
<body>
<h1>我要学会PHP语言,开发小程序</h1>
</body>
</html>
3.引入外部样式
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>css元素样式来源-引入外部样式</title>
<link rel="stylesheet" href="test3.css" />
</head>
<body>
<h1>我要学会PHP语言,开发小程序</h1>
</body>
</html>
test3.css的代码如下:
h1 {
color: darkgreen;
}