這裡有一個特別的關鍵字表示透明
- transparent
舉例如下
body {
color: white;
background-color: navy;
}
/* 《程式語言教學誌》的範例程式
http://pydoing.blogspot.com/
檔名:background01.css
功能:示範 CSS 2.1 樣式表的使用
作者:張凱慶
時間:西元 2011 年 7 月 */我們以下面的 HTML 文件載入
<html>
<head>
<title>網頁標題</title>
<link rel="stylesheet" type="text/css"
href="background01.css">
</head>
<body>
<p>You ever have that feeling where you're not sure if
you're awake or still dreaming?</p>
<p>A prison for your mind.</p>
<p>Free your mind.</p>
<p>Believe the unbelievable.</p>
<p>There is no spoon.</p>
<p>I can only show you the door, you have to walk
through it.</p>
<p>Choice. The problem is choice.</p>
<p>Then tomorrow we may all be dead, but how would that
be different from any other day?</p>
<p>I have dreamed a dream, but now that dream has gone
from me.</p>
<p>Choice is an illusion, created between those with
power, and those without.</p>
<p>Because I choose to.</p>
<p>Everything that has a beginning has an end.</p>
</body>
</html>
<!-- 《程式語言教學誌》的範例程式
http://pydoing.blogspot.com/
檔名:background01.html
功能:示範 CSS 2.1 樣式表的使用
作者:張凱慶
時間:西元 2011 年 7 月 -->瀏覽器 (broswer) 開啟如下

此例中將 <body> 設定的深藍底白字,所以 <body> 的所有子代 (child) 元素 (element) 都繼承 (inherit) 深藍底白字的樣式 (style) 。
另舉一例如下
.example {
color: white;
background-color: navy;
}
/* 《程式語言教學誌》的範例程式
http://pydoing.blogspot.com/
檔名:background02.css
功能:示範 CSS 2.1 樣式表的使用
作者:張凱慶
時間:西元 2011 年 7 月 */我們以下面的 HTML 文件載入
<html>
<head>
<title>網頁標題</title>
<link rel="stylesheet" type="text/css"
href="background02.css">
</head>
<body>
<p class="example">
You ever have that feeling where you're not sure if
you're awake or still dreaming?</p>
<p>A prison for your mind.</p>
<p>Free your mind.</p>
<p>Believe the unbelievable.</p>
<p>There is no spoon.</p>
<p>I can only show you the door, you have to walk
through it.</p>
<p>Choice. The problem is choice.</p>
<p class="example>
Then tomorrow we may all be dead, but how would that
be different from any other day?</p>
<p>I have dreamed a dream, but now that dream has gone
from me.</p>
<p class="example>
Choice is an illusion, created between those with
power, and those without.</p>
<p>Because I choose to.</p>
<p>Everything that has a beginning has an end.</p>
</body>
</html>
<!-- 《程式語言教學誌》的範例程式
http://pydoing.blogspot.com/
檔名:background02.html
功能:示範 CSS 2.1 樣式表的使用
作者:張凱慶
時間:西元 2011 年 7 月 -->瀏覽器開啟如下

此利用類別選取器 (class selector) example ,所以只有設定成 example 類別 (class) 的 <p> 才是深藍底白字。
| 中英文術語對照 | |
|---|---|
| 性質 | property |
| 關鍵字 | keyword |
| 函數 | function |
| 瀏覽器 | broswer |
| 子代 | child |
| 元素 | element |
| 繼承 | inherit |
| 樣式 | style |
| 類別選取器 | class selector |
| 類別 | class |
您可以繼續參考
JavaScript 範例
背景相關
相關目錄
CSS 2.1 快速導覽
HTML, CSS 教材
首頁
參考資料
http://www.w3.org/TR/CSS21/colors.html
https://developer.mozilla.org/en/CSS/background-color
沒有留言:
張貼留言