譯文:網頁樣式表 - CSS的提示與竅門
英文: http://www.w3.org/Style/Examples/007/alternatives
說明:

翻譯: Chinese Translation Services

網頁樣式表
CSS的提示與竅門

交替樣式表

一份文擋並不需要單個樣式表。你可以給它一個默認的樣式,並從中爲讀者提供幾種選擇,比如說,本頁擁有所有的 W3C 的核心樣式, 以及其他網路上找到的兩個樣式表(作者:David Baron)來做爲“交替樣式”。

至於讀者如何選擇“交替樣式”則是取決於瀏覽器,並不是所有的瀏覽器對此都提供功能表。然而,以Netscape第六版本爲例,你卻可以在功能表裏的“view”(查看)->“Use Stylesheet”(使用樣式表)找到所有的樣式。

如要把額外的樣式表也包括在裏面,則在頁頭處添加更多的〈LINK〉元素便可,而且要用對REL和TITLE的屬性,就象以下所表示的。(我把某些樣式拿掉了;見本文檔的資源以得到更多鏈結。)

 
  <link rel="stylesheet"
    title="Gold (right, fixed) + navbar"
    href="../threepart-f.css">
 
  <link rel="alternate stylesheet"
    title="Oldstyle"
    href="http://www.w3.org/StyleSheets/Core/Oldstyle">
 
  <link rel="alternate stylesheet"
    title="Modernist"
    href="http://www.w3.org/StyleSheets/Core/Modernist">
  ...
  <link rel="alternate stylesheet"
    title="Steely"
    href="http://www.w3.org/StyleSheets/Core/Steely">
 
  <link rel="alternate stylesheet"
    title="Forest (by David Baron)"
    href="http://dbaron.org/style/forest">
 
  <link rel="alternate stylesheet"
    title="Plain (by David Baron)"
    href="http://dbaron.org/style/plain">

帶有相同“TITLE”的鏈結組會被自動組合在一起從而形成一種樣式表。

CSS Valid CSS!Valid HTML 4.0!

Bert Bos
created 17 Jan 2001;
last updated $Date: 2009/09/08 16:51:39 $ GMT