1. 设置字体 (h2标题)
<html>
<head>
<title>网页标题</title>
<style>
h2{
font-family:宋体;
font-style:normal;
font-size:30px;
color:green;
}
</style>
</head>
<body>
<form method="post" action="">
<h2>css标记1</h2>
<p>css标记的内容</p>
<h2>css标记2</h2>
<p>css标记的内容</p>
<h2>css标记3</h2>
<p>css标记的内容</p>
<h2>css标记4</h2>
<p>css标记的内容</p>
</form>
</body>
<html>
2. 内嵌样式css
<html>
<head>
<title>css内嵌样式</title>
</head>
<body bgcolor="#FFFFFF">
<form method="post" action="">
<h2 style="background-color:#ABBED3; color:#F00; font-size:36px; margin-top:10px;">css标记1</h2>
<p>css标记1</p>
<h2>css内容</h2>
<p>css标记2</p>
<h2>css内容2</h2>
<p>css标记3</p>
<h2>css标记4</h2>
<p>css内容4</p>
</form>
</body>
</html>
3. 引用外部css
3.1 1.css
h2{
font-family:Verdana, Geneva, sans-serif;
font-style:normal;
font-size:30px;
color:#AA7BC4;
}
3.2 1-6.html
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<HTML>
<HEAD>
<TITLE>cdd外部引用样式</TITLE>
<link href="1.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function init(){
alert("jiazao");
document.getElementById("m1").innerHTML="长沙市";
}
</script>
</HEAD>
<BODY BGCOLOR="#FFFFFF" onLoad="init();">
<form>
<h2 id="ys1">css</h2>
<h2 id="ys2">css</h2>
<span id="m1"></span>
</form>
</BODY>
</HTML>