One. Inline styles
(rarely used)
<h1>静夜思</h1>
<p>床前明月光,</p>
<p style="color: red;">疑是地上霜。</p>
<p style="color: #0000FF;font-size: 1rem;">举头望明月,</p>
<p>低头思故乡。</p>
two. Inline style
(commonly used in small and medium sized page)
<head>
<meta charset="utf-8">
<title>
</title>
<style type="text/css">
h1{color: red;}
#aa{color: #0000FF;}
.bb{color: #00FF00;}
</style>
</head>
<body>
<h1>静夜思</h1>
<p id="aa">床前明月光,</p>
<p class="bb">疑是地上霜。</p>
<p>举头望明月,</p>
<p>低头思故乡。</p>
</body>
three. External links
(commonly used in large Web pages)
the new .css file, the file does not need to write in css <style>
connection. 1 <Link the rel = "this stylesheet" type = "text / css" the href = " .css" />
Connection 2 <style type = "text / CSS"> @ Import URL ( " .css"); </ style>
Stylesheet:
.red{color: red;}
#green{color: green;}
Connection 1
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="css/样式表.css"/>
</head>
<body>
<h1>静夜思</h1>
<p class="red">床前明月光,</p>
<p>疑是地上霜。</p>
<p id="green">举头望明月,</p>
<p>低头思故乡。</p>
</body>
Connection 2
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
@import url("样式表.css");
</style>
</head>
<body>
<h1>静夜思</h1>
<p class="red">床前明月光,</p>
<p>疑是地上霜。</p>
<p id="green">举头望明月,</p>
<p>低头思故乡。</p>
</body>