1、行內樣式(內聯樣式)
例:<body >
2、內部樣式
例:<head>
<style type="text/css">
body {
background-color:#cccccc;}</style></head>
3、外部樣式
例:
body { background-color:#cccccc;
}
<head>
<link rel="stylesheet" type="text/css" href="" />
</head> css選擇器
1、標籤選擇符(又稱為元素選擇符、類型選擇符)
2、id 及 class 選擇符
3、屬性選擇符 [title] a{color:red;} (為所有的屬性是title的a標籤的元素變成紅色)
4、包含選擇符
5、偽類選擇符
a:link {color: #FF0000; text-decoration: none} /* 未訪問的鏈接 */
a:visited {color: #00FF00; text-decoration: none} /* 已訪問的鏈接 */
a:hover {color: #FF00FF; text-decoration: underline} /* 鼠標在鏈接上 */
a:active {color: #0000FF; text-decoration: underline} /* 激活鏈接 */
6、優先級依次是:
行內樣式表 > 內部樣式表 > 外部樣式表
7、選擇符id的定義優先於class 的定義
8、通配符 *
9、瀏覽器優先執先 !important標註的語句。