樣式表中文手冊。什么是樣式表:CSS 是 Cascading Style Sheet 的縮寫。譯作「層疊樣式表單」。是用于(增強(qiáng))控制網(wǎng)頁樣式并允許將樣式信息與網(wǎng)頁內(nèi)容分離的一種標(biāo)記性語言。如何將樣式表加入您的網(wǎng)頁:你可以用以下三種方式將樣式表加入您的網(wǎng)頁。而最接近目標(biāo)的樣式定義優(yōu)先權(quán)越高。高優(yōu)先權(quán)樣式將繼承低優(yōu)先權(quán)樣式的未重疊定義但覆蓋重疊的定義。
入外部樣式表文件 (Linking to a Style Sheet)
你可以先建立外部樣式表文件(.css),然后使用HTML的link對象。示例如下:
<head>
<title>文檔標(biāo)題</title>
<link rel=stylesheet href="http://www.dhtmlet.com/dhtmlet.css" type="text/css">
</head>
而在XML中,你應(yīng)該如下例所示在聲明區(qū)中加入:
<? xml-stylesheet type="text/css" href="http://www.dhtmlet.com/dhtmlet.css" ?>
定義內(nèi)部樣式塊對象 (Embedding a Style Block)
你可以在你的HTML文檔的<HTML>和<BODY>標(biāo)記之間插入一個<STYLE>...</STYLE>塊對象。
<html>
<head>
<title>文檔標(biāo)題</title>
<style type="text/css">
<!--
body {font: 10pt "Arial"}
h1 {font: 15pt/17pt "Arial"; font-weight: bold; color: maroon}
h2 {font: 13pt/15pt "Arial"; font-weight: bold; color: blue}
p {font: 10pt/12pt "Arial"; color: black}
-->
</style>
</head>
<body>
這里將style對象的type屬性設(shè)置為"text/css",是允許不支持這類型的瀏覽器忽略樣式表單。
內(nèi)聯(lián)定義 (Inline Styles)
內(nèi)聯(lián)定義即是在對象的標(biāo)記內(nèi)使用對象的style屬性定義適用其的樣式表屬性。示例如下:
<p style="margin-left: 0.5in; margin-right:0.5in">這一行被增加了左右的外補(bǔ)丁<p>
樣式表語法 (CSS Syntax)
Selector { property: value }
參數(shù)說明:
Selector -- 選擇符
property : value -- 樣式表定義。屬性和屬性值之間用冒號(:)隔開。多個定義之間用分號(;)隔開
繼承的值 (The ' Inherit ' Value)
每個屬性都有一個指定的值: Inherit 。它的意思是:將父對象的值等同為計(jì)算機(jī)值得到。這個值通常僅僅是備用的。顯式的聲明它可用來強(qiáng)調(diào)。
Properties Reference
文本屬性 Text Properties
表格屬性 Table Properties
滾動條屬性 Scrollbar Properties
打印屬性 Printing Properties
定位屬性 Positioning Properties
內(nèi)補(bǔ)丁屬性 Paddings Properties
輪廓屬性 Outlines Properties
外補(bǔ)丁屬性 Margins Properties
列表屬性 Lists Properties
布局屬性 Layout Properties
字體屬性 Font Properties
尺寸屬性 Dimensions Properties
內(nèi)容屬性 Generated Content Properties
邊框?qū)傩?Borders Properties
背景屬性 Background Properties
聲音屬性 Aural Properties