CSS(三)外部樣式表
阿新 • 來源:網路 • 發佈:2022-12-22
外部樣式表
- 外部樣式:外部樣式表就是新建一個文件,裡面全寫css,然後再通過link插到html程式碼中
- 作用:使網頁的表示層與結構層徹底分離
- 示例:將背景設定,修改為外部樣式表
<link rel="stylesheet" type="text/css" href="index.css>
- 小貼士:除了link進行外部樣式表的連結,還是其他方法哦
實戰
- index.css 檔案
p{
background-color: red;
font-size: 40px;
}
.p1{
font-family: 隸書;
}
body{
background-color: blue;
background-image: url("image/12.jpeg");
background-repeat: no-repeat;
background-attachment: fixed;
background-position: top left;
}
- index.html 檔案
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="index.css">
</head>
<body>
<p>https://www.baidu.com</p>
<p>百度</p>
<p class="p1">jaodsjfinovajdoifhogjaoisdjfioad驕傲ID房價回購
瓦爾哦啊哦安東覅好IG阿道夫</p>
</body>
</html>
