本文轉載於:猿2048網站引入css的四種方式php
1.內聯式引用:直接用在標籤上,但維護成本高css
style='font-size:16px;color:#000000'
2.外部鏈接式引用:css代碼與html代碼分離,便於代碼重複使用html
<link href="css/style.css" type="text/css" rel="stylesheet" />
style.css文件內容如右:網站
.font{color:blue;font-size:12px;}
3.內部式引用:頁面較爲清晰,但不能被別的頁面使用url
<style type='text/css'> .font{color:blue;font-size:12px;} </style>
4.外部導入式:能夠在一個HTML文件中導入多個樣式表。相似於外部連接式引用
在HTML文件中head標籤中加入spa
<style type='text/css'> @import url('./style/style.css'); </style>