CSS样式表由选择器和样式规则组成,基本格式如下:h1{coler: red}
CSS样式表的注释法:/*...*/
CSS样式表的使用法:
行内声明:
<h1 style="color: red; font-family: Broadway B; font-weight: bold; border: 1px #336699 solid">我是标题</h1>
内嵌声明:
<head>
<meta charset="UTF-8">
<title>认识CSS样式</title>
<style type="text/css" media="screen">
h2 {
font-size: 12px;color:
line-height:16px;
border: 1px #336699 solid;
}
</style>
</head>
链接外部样式文件:
<head>
<meta charset="UTF-8">
<title>认识CSS样式</title>
<style type="text/css" media="screen">
@import “样式文件的路径/文件名";
</style>
</head>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title>认识CSS样式</title>
<style type="text/css" media="screen">
h2 {
font-size: 12px;color:
line-height:16px;
border: 1px #336699 solid;
}
</style>
</head>
<body>
<h1 style="color: red; font-family: Broadway B; font-weight: bold; border: 1px #336699 solid">我是标题</h1>
</body>
</html>