iLMS知識社群ePortfolioeeClass學習平台空大首頁登入
(2012-10-16) 數位內容導論 第11講
by 李百麗 2012-10-16 13:43:35, 回應(0), 人氣(915)
---CSS排版樣式的用法---
1.inline,直接在tag上,使用style屬性。
2.embeding,先定義css樣式的類別(class)或者識別碼(id),然後在tag上使用class的屬性或id屬性。
3.linking,將css樣式的class或id定義在一個檔案(.css檔),然後在tag上使用class的屬性或id屬性。

---CSS Linking用法的例子(1/2)---
<html><head>
<title>My first XHTML page</title>
<link rel="stylesheet" type="text/css" href="css1.css"/>
</head>
<body>
<p>This is my first XHTML page</p>
<p class="bigsans">This is the second paragraph of my first XHTML page</p>
</body></html>

---CSS Linking用法的例子(2/2)---
p{
   font-size:16pt;
   font-family:'comic sans MS','fantasy';
   color:maroon;
}
.bigsans{
   font-size:24pt;
   font-family:arial,sans-serif;
   color:red;
}

---以瀏覽器實測---
.CSSlink.htm
.CSS1.css

---css與HTML的完美配合---
.HTML標籤只負責"content"(內容)。
.css負責外觀。
.若以linking的方式使用css,css檔還可以存放在遠端伺服器上。

---css檔存放在遠端web server的實例測試---
.css1.css的儲存路徑為
http://www2.nkfust.edu.tw/~weichih/CSS/css1.css
.<link rel="stylesheet" type="text/css" href="css1.css"/>
相對路徑
改為
.<link rel="stylesheet" type="text/css" href="http://www2.nkfust.edu.tw/~weichih/CSS/css1.css"/>
絕對路徑

---css的學習網站介紹---
http://www.pcnet.idv.tw/pcnet/css/