Cascade Style Sheet 層疊樣式表
css和html的結合方式?
也就是學習如何在HTML里如何使用css,共有三種方式。
結合方式1
<code>
<!DOCTYPE html>
<html>
<head>
<title>01-結合方式1.html</title>
<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p style='color:red;'> This is my HTML page. </p><br>
</body>
</html>
</code>
結合方式2
<pre>
<!DOCTYPE html>
<html>
<head>
<title>02-結合方式2.html</title>
<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<style type="text/css">
p{
color:red;
}
</style>
</head>
<body>
<p style='color:red;'> This is my HTML page. </p>
</body>
</html>
</pre>
結合方式3
<!DOCTYPE html>
<html>
<head>
<title>03-結合方式3.html</title>
<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">
<!-- 結合方式3:
需要創建一個.css文件
<link rel="stylesheet" type="text/css" href="./p.css">
-->
<link rel="stylesheet" type="text/css" href="./p.css">
</head>
<body>
<p style='color:red;'> This is my HTML page. </p><br>
</body>
</html>
圖片在這里!。
結合方式ok
CSS語法?(了解)
<pre>
<!DOCTYPE html>
<html>
<head>
<title>02-結合方式2.html</title>
<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
p{
color:red;
}
</style>
</head>
<body>
<p style='color:red;'> This is my HTML page. </p>
</body>
</html>
</pre>