這是本文件的舊版!
選擇器主要有三種:
<style type="text/css">
<!--
H3, H5 {
color : #999999 ;
font-family : 細明體
}
-->
</style>
其中的 H3 與 H5 就是選擇器。
CSS宣告檔內容
<style type="text/css">
<!--
.one{
color : #cc6699 ; /*文字色彩*/
font-size : 9pt; /*文字大小*/
}
.two{
color : #336699 ; /*文字色彩*/
letter-spacing : 3pt;/*字距*/
font-size : 9pt; /*文字大小*/
}
-->
</style>
HTML內容
<p class="one">這裡的文字是粉色9pt的大小</p> <p class="two">這裡的文字是藍色9pt字的距離4pt的大小</p> <input class="one" type="text" name="T1" size="20" value="這裡是表單"> <table class="two" width="182"> <tr> <td> 這裡是表格 </td> </tr></table>
其中的 .one 與 .two 就是選擇器。
CSS宣告檔內容
#one{
color : #cc6699 ; /*文字色彩*/
font-size : 9pt; /*文字大小*/
}
#two{
color : #336699 ; /*文字色彩*/
letter-spacing : 3pt;/*字距*/
font-size : 9pt; /*文字大小*/
}
HTML內容
<input id="one" type="text" name="T1" size="20" value="這裡是表單"> <table id="two" width="182"> <tr> <td> 這裡是表格 </td> </tr></table>
其中的 #one 與 #two 就是選擇器。
選擇器 {
屬性1: 設定值;
屬性2: 設定值;
...
}