显示标签为“Web Design”的博文。显示所有博文
显示标签为“Web Design”的博文。显示所有博文

CSS:属性索引

{ Posted on 星期二, 十二月 08, 2009 by Kaiser.XKw }
CSS2.1属性按功能索引

CSS: 语法基础

{ Posted on 星期二, 十二月 08, 2009 by Kaiser.XKw }
CSS 的全名為 Cascading Style Sheets,是一種樣式表 (Stylesheet) 語言。它的目的是為了對像 XHTML 及 HTML 之類的標記語言 (markup language) 提供一個顯示層。有了 CSS,我們就可以將資料層及顯示層分開:HTML 文件就只包括資料,而 CSS 則是告訴瀏覽器這些資料應該要如何顯現出來

宣告 CSS 樣式的語法如下: 選擇器 {
     屬性:設定值;
     ...
}
在一個選擇器 (Selector) 中,可以設定的屬性數目沒有限制。
選擇器主要有三種:型類 (Type) 選擇器、Class 選擇器、和 ID 選擇器。
型類選擇器是 (X)HTML 標籤,如 <body> 和 <h1>。Class 和 ID 選擇器是使用者自訂的選擇器。

Grouping
如果有數個選擇器享有同樣的樣式,它們可以同時被宣告。這叫做 "grouping"。舉例來說,如果 <h1>, <h2>, and <h3> 都會有相同的樣式,那它們就可以用以下的方式被宣告:
h1 h2 h3 {
    屬性:設定值;
    ...
}

後代選擇器 (Descendant Selectors)
我們可以設定說,只有當甲元素在乙元素之內時,甲元素才會用某個樣式。若甲元素不在乙元素內的話,那甲元素就可以有其他的樣式。要達到這個目標,我們就要利用後代選擇器的方式。 後代選擇器宣告的語法是:
父選擇器】【子選擇器】{
    屬性:設定值;
    ...
}
在以上的宣告中,只有當子選擇器是在父選擇器之內時,樣式才會被用到。這一類的語法可以包括好幾代的選擇器,而不是只有兩代而已。
舉例來說,以下的宣告: li b {
    color:yellow;
}
代表在 <li> <b> 之內的文字是黃色的。不是在 <li> 之內的 <b> 中的文字,就不會套用黃色字體這個樣式。


將 CSS 套用入 HTML 文件中的四種方式

嵌入套用
樣式可以嵌入於 HTML 文件中 (通常是在 <head> 內)。舉例來說, <head>
<style type="text/css">
div {
background-color:#FF0000;
}
</style>
</head>

<body>
<div>
背景顏色是紅色
</div>
</body>
以上的 HTML 會顯現出:

背景顏色是紅色

外部連接套用
在這種方式下,所有的 CSS 樣式宣告都是存在另外一個檔案中。該檔案通常名稱為 .css。在 HTML 文件的 <header> .. </header> 之中,我們將用以下的程式碼將這個 .css 檔案連接進入: <link rel=stylesheet type="text/css" href="external-stylesheet.css"> 以上這一行會將在 external-stylesheet.css 這個檔案內所宣告的樣式加入 HTML 文件內。

匯入套用
外部的 CSS 樣式也可以被匯入進 HTML 文件。匯入的做法為利用 @import 這個指令。@import 的語法為: <STYLE TYPE="text/css">
<!--
@import url(http://www.mysite.com/style.css);
-->
</STYLE>
@import 指令最初的用意,是為了能夠針對不同的瀏覽器而運用不同的樣式。不過,現在已經沒有這個必要。現在用 @import 的目的,最常是要加入多個 CSS 樣式。當多個 CSS 樣式被 @import 的方式加入,而不同 CSS 樣式互相有衝突時,後被加入的 CSS 樣式有優先的順位 (詳情請見 CSS 串接)。


CSS 媒體類別
不同的媒體類別可以用不同的 CSS 樣式表。舉例來說,在螢幕上的文件可能適用某一個 CSS 樣式表,而同一份文件在被列印時,可以用一個不同的 CSS 樣式表。標出一個 CSS 樣式表媒體類別的語法如下:

外部連接套用 <link rel="stylesheet" href="style.css" type="text/css" media="【媒體類別】">

嵌入套用 <style type="text/css" media="【媒體類別】">

匯入套用 @import url("style.css") 【媒體類別】;

媒體類別】可以有以下的值:
值 適用於
all 所有媒體類別
aural 言語合成器
braille 布拉耶點字法 (盲人用) 媒體
handheld 掌上型媒體
print 列印
projection 投射媒體
screen 電腦螢幕
tty 固定字寬 (fixed-pitch) 的媒體
tv 電視類的媒體


CSS 串接
CSS 的全名為 Cascading Style Sheets。如果只有一個樣式表,那『串接』(cascade) 這個部分就不重要。若一個 HTML 文件中包含有多個樣式表,那串接這個概念就非常重要了。串接是指當不同樣式表中對相同屬性有不同定義時,應該要用哪一個樣式表中的定義的規則。

最基本的規則是,越接近 HTML 本身的樣式越有優先權。

另外,每一個瀏覽器也都有自己的樣式表 (這就是為什麼超連接文字通常會是藍色,而且下面有一條線)。這一類的樣式表優先權比以上的幾種都低。

所以,從最高優先權到最低優先權的排名如下:
  • 內行套用的樣式表 (Inline stylesheet)
  • 嵌入套用的樣式表 (Embedded stylesheet)
  • 匯入套用的樣式表 (Imported stylesheet)
  • 外部連接套用的樣式表 (Linked stylesheet)
  • 瀏覽器本身的樣式表 (Browser's own stylesheet)


CSS 繼承
在一個 HTML 文件中,標籤之間有所謂的親子關係。舉例來說,<title> 這個標籤一定都是在 <head> 這個標籤之內,所以我們就說 <title> 是 <head> 的子標籤。繼承 (inheritance) 的意思就是說子標籤的樣式會跟父標籤一樣,除非子標籤本身另有自訂的樣式 舉例來說,如果我們有以下的樣式:

p { color: #00FF00; }
strong { font-size:20px; }
下面這行 HTML 碼,<p>這是一個 <strong>繼承的例子。</strong></p>
就會顯現出為:

這是一個繼承的例子。

在以上的例子中,雖然我們並沒有對 <strong> 設定顏色,可是我們可以看到,整個句子的顏色都是綠色的。這是因為, <strong> 是 <p> 的子標籤,所以 <strong> 繼承了 <p> 的樣式,而在 <p> 的樣式中,文字顏色是設定為綠色的。


CSS Class 與 CSS ID  Class 及 ID 都是使用者設定的選擇器 (selector)。

Class
Class 的宣告法,是先放一個句點 (.),之後再列出選擇器名稱。設定一個 Class 選擇器的語法如下: .【Class 名稱】{
屬性:設定值;
    ...
}
舉例來說 .navbar {
    color:#0000FF;
}
要將以上的樣式套用在 HTML 內,我們用以下的 HTML 碼: <p class="navbar">這是用 Class 選擇器的例子。</p> 以上的 HTML 碼會顯現出:
這是用 Class 選擇器的例子。
一個 Class 選擇器可以同時有好幾個不同的物件 (instance)。這是靠以下的語法: 【型類選擇器】.【選擇器名稱】{
屬性:設定值;
    ...
}
舉例來說,若有以下的 CSS 宣告 b.special {
color:#0000FF;
}

i.special {
color:#FF0000;
}
以下的 HTML 碼

這個例子顯示出 <b class="special">同一個選擇器</b>可以<i class="special">有不同的 instance。</i>.

就会顯現出: 這個例子顯示出同一個選擇器可以有不同的 instance。.

多重 Class
我們也可以同時套用數個 class。舉例來說,若我們有以下的 CSS 宣告, .applylarge {
font-size:20px;
}

.applyred {
color:#FF0000;
}
那以下的 HTML 碼, <p class="applylarge applyred">這是多重 Class 的例子。</p>

ID    ID 的宣告法,是先放一個井字號 (#),之後再列出選擇器名稱。設定一個 ID 選擇器的語法如下: #【ID 名稱】{
屬性:設定值;
...
}
舉例來說 #footer {
color:#FF00FF;
}
要將以上的樣式套用在 HTML 內,我們用以下的 HTML 碼: <p id="footer">這是用 ID 選擇器的例子。</p>
>

Class 跟 ID 的比較
這兩者最大的不同,是在於 ID 選擇器在一個 HTML 文件中只能被使用一次,而 Class 選擇器在一個 HTML 文件中可以被使用多次。第二個不同的地方,是 ID 選擇器可以被 Javascript 中的 GetElementByID 函數所運用,而 Class 選擇器無法被 Javascript 運用到。

並沒有什麼固定的規則,來決定什麼時候要用 ID 及什麼時候要用 Class。我們的建議是盡量用 Class,因為這樣子最靈活 (同一個 HTML 文件可以利用這類的選擇器多次)。唯一的例外,是當你要用 Javascript 的 GetElementByID 函數時。在這個情況下,你就應該要用 ID。

Class 名稱及 ID 名稱都是對大小寫敏感的。舉例來說,.classone 及 .ClassOne 是代表兩個不同的 Class 選擇器。


CSS Div 與 CSS Span

Div    這個標籤目的是將內容分為不同的區域,而每一個區域可以根據 CSS 中的宣告而有自己的樣式。Div 是一個區塊級容器 (block-level container),這代表在 </div> 標籤後會換行。

舉例來說,如果我們有以下的 CSS 樣式: .large {
color: #00FF00;
font-family:arial;
font-size: 4pt;
}
以下的 HTML 碼 <div class="large">
這是 DIV 範例。
</div>

Span     Span 跟 Div 類似的地方是,這兩個標籤的目的都是將內容分為不同的區域。不同的是,Span 可以涵蓋更細層的元素。所以,我們甚至可以用 <span> 來調整單一文字的樣式。另外,在 </span> 之後並不會換行。。。。

舉例來說,如果我們有以下的 CSS 樣式: .largefont {
color: #0066FF;
font-family:arial;
font-size: 6px;
}
以下的 HTML 碼 Span 不是<span class="largefont">區塊級的</span>.
CSS 長度單位

在 CSS ,長度單位可以分為兩大類:絕對 (absolute) 單位以及相對 (relative) 單位。
相對單位包括:

  • px: pixels
  • em: em
  • ex: x 字母的高度
    絕對單位包括:
  • in: 吋
  • cm: 公分
  • mm: 公厘
  • pt: points, 1 pt = 1/72 吋
  • pc: picas, 1 pc = 12 pt

    如果沒有註明單位,那預設的單位是 px。

    以下是每一種單位的例子:

    CSS 樣式 顯現結果
    p {font-size:9px;}

    文字大小為 9px。

    p {font-size:3em;}

    文字大小為 3em。

    p {font-size:3ex;}

    文字大小為 3ex。

    p {font-size:0.2in;}

    文字大小為 0.2 inch。

    p {font-size:0.5cm;}

    文字大小為 0.5 cm。

    p {font-size:12mm;}

    文字大小為 12 mm。

    p {font-size:24pt;}

    文字大小為 24 pt。

    p {font-size:2pc;}

    文字大小為 2 pc。

    在大部分的情況下,用相對長度單位會比較適合。這是因為,這樣子您能讓使用者依自己的喜好來加大或減小字體。如果您用絕對長度單位的話,使用者就無法改變字體的大小了。
  • Color IQ

    { Posted on 星期一, 十二月 07, 2009 by Kaiser.XKw }
    看到一个测试Color IQ的站点,得个18分,0分是最完美地..
    呵呵,看来美感还得加强啊...
    Online Color Challenge
    http://www.xrite.com/custom_page.aspx?PageID=77

    CSS: 將li元素橫向顯示

    { Posted on 星期一, 十二月 07, 2009 by Kaiser.XKw }
    代碼:

    <style type="text/css">
    #navitest {
    width:450px;
    }
    #navitest ul li {
    /* 設定清單文字範圍的寬度 */
    width:150px;
    /* 讓清單文字居中對齊 */
    text-align:center;
    /* 去除清單文字前面的小圓點*/
    list-style-type:none;
    /* 設定背景色 */
    background-color:#FF9900;
    }

    #navitest ul li a:link {
    color:#FFFFFF;
    text-decoration:none;
    }
    #navitest ul li a:visited {
    color:#FFFFFF;
    text-decoration:none;
    }
    #navitest ul li a:hover {
    /* 文字為白色 */
    color:#FFFFFF;
    /* 文字沒有裝飾(底線) */
    text-decoration:none;
    /* 背景為橙紅色 */
    background-color:#FF6600;
    }
    #navitest ul li a:active {
    color:#FFFFFF;
    text-decoration:none;
    }

    #navitest ul li a {
    /* 充滿整個區塊 */
    display: block;
    /* 擴大區域內部空間 */
    padding:5px;
    }

    #navitest ul li{
    width:150px;
    text-align:center;
    list-style-type:none;
    background-color:#FF9900;
    /* 讓各個清單元素靠左對齊 */
    float:left;
    /* 設定邊框底部的樣式 */
    border-bottom:#CCCCCC solid 3px;
    /* 右邊留白1像素 */
    margin-right:1px;
    }
    </style>

    <div id="navitest">
    <ul>
    <li><a href="#">首頁</a></li>
    <li><a href="#">最愛</a></li>
    <li><a href="#">收藏</a></li>
    </ul>
    </div>

    效果:

    美化Blogger - 使用Lightbox显示图片

    { Posted on 星期五, 十二月 04, 2009 by Kaiser.XKw }

    看到一个很cool的图片显示特效,4个js文件和1个css文件让blog中的图片连接在点击时出现电影播放的特效,页面变暗图片慢慢展看...
    经过一翻搜索和实做,终于在我的blog上建立OK.

    Step 1. 修改 Template

    進「Template\Edit HTML」的畫面。請先備份(點擊 Download Full Template)。找到以下代碼。 ]]></b:skin>
    </head>
    然後插入以下代碼。<link   href='http://klcintw.css.googlepages.com/lightbox.css' media='screen' rel='stylesheet' type='text/css'/>
    <script src='http://klcintw.js.googlepages.com/prototype.js' type='text/javascript'></script>
    <script src='http://klcintw.js.googlepages.com/scriptaculous.js?load=effects' type='text/javascript'></script>
    <script src='http://klcintw.js.googlepages.com/lightbox.js' type='text/javascript'></script>

    然後在</body>前面加上以下片段。

    <script>
    var WidgetManager_HandleControllerResult = _WidgetManager._HandleControllerResult;
    _WidgetManager._HandleControllerResult = function() {
        try {
             WidgetManager_HandleControllerResult.apply(this, arguments);
             initLightbox();
        } catch(e) {}
    }
    </script>

    Step 2. 修改 Post

    在要套用Lightbox效果的圖片或連結加上「rel="lightbox"」並將href指向要顯示的內容url。如上面的範例中,小圖的url是http://xxx/small.jpg,而大圖的url是http://xxx/large.jpg,完整的HTML代碼如下:

    <a href="http://xxx/large.jpg" rel="lightbox">
    <img src="http://xxx/small.jpg" /></a>

    更多Lightbox的運用(如多圖顯示)請參考「Lightbox JS v2.0」或「swf.com.tw » 使用LightBox展示線上影像」的介紹。

    因为网络的关系;效果偶爾會時好時壞,越南这个地方基础建设还有待加强啊!我把相关文件放到了google的协作平台上还是时有时无的,不过google自己的浏览器会执行的情况要比IE好.

    美化Blogger - 显示快速编辑和Email转发的小图标

    { Posted on 星期四, 八月 20, 2009 by Kaiser.XKw }
        更新blog后发现在快速编辑和Email转发的小图标没有了,现在虽然用得少,难免以后不会用,所以还是想办法找回来比较好...

        查来查去,发现程式里面有相关的设定阿~ 估计可能是图片显示的问题,所以重新在<b:skin> </b:skin>之间加入关于图片显示的css,果然出现了... /* -------------- * email-post-icon & quick-edit-icon* ------------------- */ .email-post-icon {
    background: url("http://www.blogger.com/img/icon18_email.gif") no-repeat left;
    padding: 9px;
    }
    .quick-edit-icon {
    background: url("http://www.blogger.com/img/icon18_edit_allbkg.gif") no-repeat left;
    padding: 9px;
    }

    私人言论,未经本人同意请勿转载...

    美化Blogger - 隐藏Blogger的页首工具条

    { Posted on 星期三, 八月 19, 2009 by Kaiser.XKw }
        发现Blog的工具条老是显示在页首,除了那个登入按钮外, 其他的根本没有用到过,看多了还有点不顺眼, 把它给藏起来吧!

        看了一下其他前辈的blog,比对一下代码,很容易发现其中的玄机
    对模版修改一下,加入两小段代码即可,Code如下: /* ---------------加入的Code 1---------------------- */
    <style type="text/css">#navbar-iframe { display:block }</style>


    <style type="text/css">
    /* ---------------加入的Code 2---------------------- */
    #navbar-iframe {
    height:0px;
    visibility:hidden;
    display:none
    }

    私人言论,未经本人同意请勿转载...

    网页特效-用层模拟可以拖动的小窗

    { Posted on 星期四, 七月 16, 2009 by Kaiser.XKw }
    一段不错的代码,可以在页面上模拟窗口, 而且还可以将这些小窗口拖来拖去. 如果后续将其改为可以将最后的位置保存起来, 做个性化的页面肯定很受欢迎 <html>
    <head>
    <title>_xWin</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style type='text/css'>
    <!--
    body{font-size:12px;}
    a:visited{text-decoration:none;color:slategray;}
    a:hover{text-decoration:underline;color:slategray;}
    a:link{text-decoration:none;color:slategray;}
    -->
    </style>
    <script language=JScript>
    <!--
    //可以打包为js文件;
    var x0=0,y0=0,x1=0,y1=0;
    var offx=6,offy=6;
    var moveable=false;
    var hover='orange',normal='#336699';//color;
    var index=10000;//z-index;
    //开始拖动;
    function startDrag(obj)
    {
    if(event.button==1)
    {
    //锁定标题栏;
    obj.setCapture();
    //定义对象;
    var win = obj.parentNode;
    var sha = win.nextSibling;
    //记录鼠标和层位置;
    x0 = event.clientX;
    y0 = event.clientY;
    x1 = parseInt(win.style.left);
    y1 = parseInt(win.style.top);
    //记录颜色;
    normal = obj.style.backgroundColor;
    //改变风格;
    obj.style.backgroundColor = hover;
    win.style.borderColor = hover;
    obj.nextSibling.style.color = hover;
    sha.style.left = x1 + offx;
    sha.style.top = y1 + offy;
    moveable = true;
    }
    }
    //拖动;
    function drag(obj)
    {
    if(moveable)
    {
    var win = obj.parentNode;
    var sha = win.nextSibling;
    win.style.left = x1 + event.clientX - x0;
    win.style.top = y1 + event.clientY - y0;
    sha.style.left = parseInt(win.style.left) + offx;
    sha.style.top = parseInt(win.style.top) + offy;
    }
    }
    //停止拖动;
    function stopDrag(obj)
    {
    if(moveable)
    {
    var win = obj.parentNode;
    var sha = win.nextSibling;
    var msg = obj.nextSibling;
    win.style.borderColor = normal;
    obj.style.backgroundColor = normal;
    msg.style.color = normal;
    sha.style.left = obj.parentNode.style.left;
    sha.style.top = obj.parentNode.style.top;
    obj.releaseCapture();
    moveable = false;
    }
    }
    //获得焦点;
    function getFocus(obj)
    {
    if(obj.style.zIndex!=index)
    {
    index = index + 2;
    var idx = index;
    obj.style.zIndex=idx;
    obj.nextSibling.style.zIndex=idx-1;
    }
    }
    //最小化;
    function min(obj)
    {
    var win = obj.parentNode.parentNode;
    var sha = win.nextSibling;
    var tit = obj.parentNode;
    var msg = tit.nextSibling;
    var flg = msg.style.display=="none";
    if(flg)
    {
    win.style.height = parseInt(msg.style.height) + parseInt(tit.style.height) + 2*2;
    sha.style.height = win.style.height;
    msg.style.display = "block";
    obj.innerHTML = "0";
    }
    else
    {
    win.style.height = parseInt(tit.style.height) + 2*2;
    sha.style.height = win.style.height;
    obj.innerHTML = "2";
    msg.style.display = "none";
    }
    }
    //创建一个对象;
    function xWin(id,w,h,l,t,tit,msg)
    {
    index = index+2;
    this.id = id;
    this.width = w;
    this.height = h;
    this.left = l;
    this.top = t;
    this.zIndex = index;
    this.title = tit;
    this.message = msg;
    this.obj = null;
    this.bulid = bulid;
    this.bulid();
    }
    //初始化;
    function bulid()
    {
    var str = ""
    + "<div id=xMsg" + this.id + " "
    + "style='"
    + "z-index:" + this.zIndex + ";"
    + "width:" + this.width + ";"
    + "height:" + this.height + ";"
    + "left:" + this.left + ";"
    + "top:" + this.top + ";"
    + "background-color:" + normal + ";"
    + "color:" + normal + ";"
    + "font-size:8pt;"
    + "font-family:Tahoma;"
    + "position:absolute;"
    + "cursor:default;"
    + "border:2px solid " + normal + ";"
    + "' "
    + "onmousedown='getFocus(this)'>"
    + "<div "
    + "style='"
    + "background-color:" + normal + ";"
    + "width:" + (this.width-2*2) + ";"
    + "height:20;"
    + "color:white;"
    + "' "
    + "onmousedown='startDrag(this)' "
    + "onmouseup='stopDrag(this)' "
    + "onmousemove='drag(this)' "
    + "ondblclick='min(this.childNodes[1])'"
    + ">"
    + "<span style='width:" + (this.width-2*12-4) + ";padding-left:3px;'>" + this.title + "</span>"
    + "<span style='width:12;border-width:0px;color:white;font-family:webdings;' onclick='min(this)'>0</span>"
    + "<span style='width:12;border-width:0px;color:white;font-family:webdings;' onclick='ShowHide(\""+this.id+"\",null)'>r</span>"
    + "</div>"
    + "<div style='"
    + "width:100%;"
    + "height:" + (this.height-20-4) + ";"
    + "background-color:white;"
    + "line-height:14px;"
    + "word-break:break-all;"
    + "padding:3px;"
    + "'>" + this.message + "</div>"
    + "</div>"
    + "<div id=xMsg" + this.id + "bg style='"
    + "width:" + this.width + ";"
    + "height:" + this.height + ";"
    + "top:" + this.top + ";"
    + "left:" + this.left + ";"
    + "z-index:" + (this.zIndex-1) + ";"
    + "position:absolute;"
    + "background-color:black;"
    + "filter:alpha(opacity=40);"
    + "'></div>";
    document.body.insertAdjacentHTML("beforeEnd",str);
    }
    //显示隐藏窗口
    function ShowHide(id,dis){
    var bdisplay = (dis==null)?((document.getElementById("xMsg"+id).style.display=="")?"none":""):dis
    document.getElementById("xMsg"+id).style.display = bdisplay;
    document.getElementById("xMsg"+id+"bg").style.display = bdisplay;
    }
    //modify by haiwa @ 2005-7-14
    //http://www.51windows.Net
    //-->
    </script>

    <script language='JScript'>
    <!--
    function initialize()
    {
    var a = new xWin("1",160,200,200,200,"窗口1","窗口1<br> Kaiser.XKw@gmail.com");
    var b = new xWin("2",240,200,100,100,"窗口2","窗口2<br> http://xkwgod.blogspot.com");
    var c = new xWin("3",200,160,250,50,"窗口3","窗口3<br> http://www.pyv.com.vn");
    ShowHide("1","none");//隐藏窗口1
    }
    window.onload = initialize;
    //-->
    </script>
    </head>
    <base target="_blank">
    <body onselectstart='return false' oncontextmenu='return false' >
    <a onclick="ShowHide('1',null);return false;" href="">窗口1</a>
    <a onclick="ShowHide('2',null);return false;" href="">窗口2</a>
    <a onclick="ShowHide('3',null);return false;" href="">窗口3</a>
    </body>
    </html>

    在线制作favicon的网站

    { Posted on 星期四, 七月 16, 2009 by Kaiser.XKw }
    如果你要自定义自己blog的favicon,有一个很不错网站可以很方面的让你自己动手制作一个

    美化Blogger - 代碼的顯示

    { Posted on 星期四, 七月 16, 2009 by Kaiser.XKw }
    前段时间贴上的代码很不好看, 扩充了一下原本的模版,增加对代码的特殊显示。 首先在如下位置贴上一段对Code标签的样式定义
    然后修改其中的参数 使用该样式的时候,在相关代码前后加上<code></code> 即可出现下面效果啰 CODE {
    display: block; /* fixes a strange ie margin bug */
    font-family: Courier New;
    font-size: 10pt;
    color:#FB6204;
    overflow:auto;
    background: #f0f0f0 url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQ-qxNSE3Wz6EbeAPRxHA8dScD_R1Ha-Xoc3_cw5X-uH17h6-VHaMp0u_e_qvEbqLp2wOKVmFsGsju3nC2yDZ2UFd3Xl7mHcnHO3vDiTEMyqUJI7KCQGpdkt_R4Nq27o9KUhvNrFGwswY/) left top repeat-y;
    border: 1px solid #ccc;
    padding: 10px 10px 10px 21px;
    max-height:200px;
    line-height: 1.2em;
    }

    ]]></b:skin>
    </head>

    网页特效 - 不错的菜单效果

    { Posted on 星期四, 七月 16, 2009 by Kaiser.XKw }
    看到一个不错的菜单效果,简单,以后可以用在程式上: <style>
    /* 先把这个 xmenu 的样式放到css里 */
    .xmenu td{font-size:12px;font-family:verdana,arial;font-weight:bolder;color:#ffffff;border:1px solid

    #336699;background:#336699;filter:blendtrans(duration=0.5);cursor:hand;text-align:center;}
    </style>

    <script>
    /*
    这是把事件动作绑定到菜单上的函数
    */
    function attachXMenu(objid){
    var tds=objid.getElementsByTagName('td');
    for(var i=0;i<tds.length;i++){
    with(tds[i]){
    onmouseover=function(){
    with(this){
    filters[0].apply();
    style.background='#66CCFF'; //这是鼠标移上去时的背景颜色
    style.border='1px solid #ffffff'; //边框
    style.color='black'; //文字颜色
    filters[0].play();
    }
    }
    onmouseout=function(){
    with(this){
    filters[0].apply();
    style.background='#336699'; //这是鼠标离开时的背景颜色
    style.border='1px solid #336699'; //边框
    style.color='#ffffff'; //文字颜色
    filters[0].play();
    }
    }
    }
    }
    }
    </script>

    <!--菜单从这里开始, 注意要把class设置成和css里相同的, 还要为它设一个id-->
    <table class="xmenu" id="xmenu0" width="500" cellpadding="1" cellspacing="4" border="0" bgcolor="#336699"

    align="center">
    <tr>
    <td>Menu1</td>
    <td>Menu2</td>
    <td>Menu3</td>
    <td>Menu4</td>
    <td>Menu5</td>
    <td>Menu6</td>
    </tr>
    </table>

    <script>attachXMenu(xmenu0); //在上面这个table结束的地方执行事件动作的绑定, 这里的这个xmenu0就是那个table的

    id</script>

    <!--下面这个是竖排的-->



    <table class="xmenu" id="xmenu1" width="100" cellpadding="1" cellspacing="4" border="0" bgcolor="#336699"

    align="center">
    <tr><td>Menu1</td></tr>
    <tr><td>Menu2</td></tr>
    <tr><td>Menu3</td></tr>
    <tr><td>Menu4</td></tr>
    <tr><td>Menu5</td></tr>
    <tr><td>Menu6</td></tr>
    </table>
    <script>attachXMenu(xmenu1);</script>

    网页特效 - 模拟QQ菜单

    { Posted on 星期三, 七月 15, 2009 by Kaiser.XKw }
    <STYLE type="text/css">
    A:link { COLOR: #000000; FONT-SIZE: 12px; TEXT-DECORATION: none}
    A:visited { COLOR: #000000; FONT-SIZE: 12px; TEXT-DECORATION: none}
    A:hover { COLOR: #006CD9; FONT-SIZE: 12px; TEXT-DECORATION: none}
    BODY { FONT-SIZE: 12px;}
    TD { FONT-SIZE: 12px; line-height: 150%}
    </style>
    <script language="JavaScript">
    <!--
    function showitem(id,name)
    {
    return ("<span><a href='"+id+"' target=_blank>"+name+"</a></span><br>")
    }
    function switchQBar(number)
    {
    var i = QBar.opentitle;
    QBar.opentitle=number;
    var id1,id2,id1b,id2b
    if (number!=i && outlooksmoothstat==0){
    if (number!=-1)
    {
    if (i==-1){
    id2="blankdiv";
    id2b="blankdiv";
    }
    else{
    id2="outlookdiv"+i;
    id2b="outlookdivin"+i;
    document.all("outlooktitle"+i).style.border="1px none navy";
    document.all("outlooktitle"+i).style.background=QBar.maincolor;
    document.all("outlooktitle"+i).style.color="#ffffff";
    document.all("outlooktitle"+i).style.textalign="center";
    }
    id1="outlookdiv"+number
    id1b="outlookdivin"+number
    document.all("outlooktitle"+number).style.border="1px none white";
    document.all("outlooktitle"+number).style.background=QBar.maincolor; //title
    document.all("outlooktitle"+number).style.color="#ffffff";
    document.all("outlooktitle"+number).style.textalign="center";
    smoothout(id1,id2,id1b,id2b,0);
    }
    else
    {
    document.all("blankdiv").style.display="";
    document.all("blankdiv").sryle.height="100%";
    document.all("outlookdiv"+i).style.display="none";
    document.all("outlookdiv"+i).style.height="0%";
    document.all("outlooktitle"+i).style.border="1px none navy";
    document.all("outlooktitle"+i).style.background=QBar.maincolor;
    document.all("outlooktitle"+i).style.color="#ffffff";
    document.all("outlooktitle"+i).style.textalign="center";
    }
    }
    }
    function smoothout(id1,id2,id1b,id2b,stat)
    {
    if(stat==0){
    tempinnertext1=document.all(id1b).innerHTML;
    tempinnertext2=document.all(id2b).innerHTML;
    document.all(id1b).innerHTML="";
    document.all(id2b).innerHTML="";
    outlooksmoothstat=1;
    document.all(id1b).style.overflow="hidden";
    document.all(id2b).style.overflow="hidden";
    document.all(id1).style.height="0%";
    document.all(id1).style.display="";
    setTimeout("smoothout('"+id1+"','"+id2+"','"+id1b+"','"+id2b+"',"+QBar.inc+")",QBar.timedalay);
    }
    else
    {
    stat+=QBar.inc;
    if (stat>100)
    stat=100;
    document.all(id1).style.height=stat+"%";
    document.all(id2).style.height=(100-stat)+"%";
    if (stat<100)
    setTimeout("smoothout('"+id1+"','"+id2+"','"+id1b+"','"+id2b+"',"+stat+")",QBar.timedalay);
    else
    {
    document.all(id1b).innerHTML=tempinnertext1;
    document.all(id2b).innerHTML=tempinnertext2;
    outlooksmoothstat=0;
    document.all(id1b).style.overflow="auto";
    document.all(id2).style.display="none";
    }
    }
    }
    function getOutLine()
    {
    outline="<table "+QBar.otherclass+">";
    for (i=0;i<(QBar.titlelist.length);i++)
    {
    outline+="<tr><td name=outlooktitle"+i+" id=outlooktitle"+i+" ";
    if (i!=QBar.opentitle)
    outline+=" nowrap align=center style='cursor:hand;background-color:"+QBar.maincolor+";color:#ffffff;height:20;border:1 none navy' ";
    else
    outline+=" nowrap align=center style='cursor:hand;background-color:"+QBar.maincolor+";color:white;height:20;border:1 none white' ";
    outline+=QBar.titlelist[i].otherclass
    outline+=" onclick='switchQBar("+i+")'><span class=smallFont>";
    outline+=QBar.titlelist[i].title+"</span></td></tr>";
    outline+="<tr><td name=outlookdiv"+i+" valign=top align=center id=outlookdiv"+i+" style='width:100%"
    if (i!=QBar.opentitle)
    outline+=";display:none;height:0%;";
    else
    outline+=";display:;height:100%;";
    outline+="'><div name=outlookdivin"+i+" id=outlookdivin"+i+" style='overflow:auto;width:100%;height:100%'>";
    for (j=0;j<QBar.itemlist[i].length;j++)
    outline+=showitem(QBar.itemlist[i][j].key,QBar.itemlist[i][j].title);
    outline+="</div></td></tr>"
    }
    outline+="</table>"
    return outline
    }
    function show()
    {
    var outline;
    outline="<div id=QBarDiv name=QBarDiv style='width=100%;height:100%'>"
    outline+=QBar.getOutLine();
    outline+="</div>"
    document.write(outline);
    }
    function theitem(intitle,instate,inkey)
    {
    this.state=instate;
    this.otherclass=" nowrap ";
    this.key=inkey;
    this.title=intitle;
    }
    function addtitle(intitle)
    {
    QBar.itemlist[QBar.titlelist.length]=new Array();
    QBar.titlelist[QBar.titlelist.length]=new theitem(intitle,1,0);
    return(QBar.titlelist.length-1);
    }
    function additem(intitle,parentid,inkey)
    {
    if (parentid>=0 && parentid<=QBar.titlelist.length)
    {
    QBar.itemlist[parentid][QBar.itemlist[parentid].length]=new theitem(intitle,2,inkey);
    QBar.itemlist[parentid][QBar.itemlist[parentid].length-1].otherclass=" nowrap align=left style='height:5' ";
    return(QBar.itemlist[parentid].length-1);
    }
    else
    additem=-1;
    }
    function outlook()
    {
    this.titlelist=new Array();
    this.itemlist=new Array();
    this.divstyle="style='height:100%;width:100%;overflow:auto' align=center";
    this.otherclass="border=0 cellspacing='0' cellpadding='0' style='height:100%;width:100%'valign=middle align=center ";
    this.addtitle=addtitle;
    this.additem=additem;
    this.starttitle=-1;
    this.show=show;
    this.getOutLine=getOutLine;
    this.opentitle=this.starttitle;
    this.reflesh=outreflesh;
    this.timedelay=50;
    this.inc=10;
    this.maincolor = "#336699"
    }
    function outreflesh()
    {
    document.all("QBarDiv").innerHTML=QBar.getOutLine();
    }
    function locatefold(foldname)
    {
    if (foldname=="")
    foldname = QBar.titlelist[0].title
    for (var i=0;i<QBar.titlelist.length;i++)
    {
    if(foldname==QBar.titlelist[i].title)
    {
    QBar.starttitle=i;
    QBar.opentitle=i;
    }
    }
    }
    var QBar=new outlook();
    var tempinnertext1,tempinnertext2,outlooksmoothstat
    outlooksmoothstat = 0;


    var t;
    t=QBar.addtitle('技术文档')
    QBar.additem('Web开发',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('数据库',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    t=QBar.addtitle('计算机技术')
    QBar.additem('操作系统',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('网络安全',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('小技巧',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('硬件相关',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    t=QBar.addtitle('文摘')
    QBar.additem('求职 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('杂文 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('生活 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('人生 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('健康 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('知识 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('爱情 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('幽默笑话 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('寓言 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('教育 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('散文 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    t=QBar.addtitle('技术文档2')
    QBar.additem('Web开发',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('数据库',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    t=QBar.addtitle('计算机技术2')
    QBar.additem('操作系统',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('网络安全',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('小技巧',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('硬件相关',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    t=QBar.addtitle('文摘2')
    QBar.additem('求职 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('杂文 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('生活 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('人生 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('健康 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('知识 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('爱情 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('幽默笑话 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('寓言 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('教育 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    QBar.additem('散文 ',t,'<a href="http://xkwgod.blogspot.com" target="_blank" rel="external">http://xkwgod.blogspot.com</a>')
    //-->
    </script>

    <table id=mnuList style="WIDTH:150px;HEIGHT: 100%" cellspacing=0 cellpadding=0 align=center border=0>
    <tr>
    <td bgcolor=#F0F0E5 id=QBarShow style="HEIGHT: 100%" valign=top align=middle name="QBarShow">
    <script language="JavaScript">
    <!--
    locatefold("")
    QBar.show()
    //-->
    </script>
    </td>
    </tr>
    </table>