2006年03月5日

利用CSS使“超連結”圖片“半透明化”(Firefox適用)

如果您跟我一樣有背景圖,但是又不希望文章的圖片擋住背景圖的話…

可以參考我的方法,利用CSS使圖片“半透明化”!(Firefox亦適用)


首先形容一下我的概念︰

我希望文章內有“超連結”的圖片在“滑鼠未移到”的狀態下是呈現“半透明”的效果。

而當“滑鼠移到”圖片上時,則變成“不透明”的效果。

至於“沒有超連結”的圖片則維持正常。

範例圖片︰
My Photo

語法介紹︰(為了使大部份瀏覽器顯示正常,以下三段語法缺一不可!)

/* 舊版Mozilla語法 */
-moz-opacity: ?;

/* 新版Firefox語法 */
opacity: ?;

/* IE語法 */
filter: Alpha(Opacity=?);

/* ?問號代表透明設定值(前兩者0.1~0.9數字越小越透明,如果設定值為1則代表不透明;而IE語法設定值為10~90數字越小越透明,如果設定值為100則代表不透明) */

接著下來,請在您的CSS內容加入以下語法︰

#content a {
text-align: center; /* 設定靠左(left)、置中(center)、靠右(right) */
}
#content a img {
-moz-opacity: 0.5;
opacity: 0.5;
filter: Alpha(Opacity=50);
}
#content a:hover img {
-moz-opacity: 1;
opacity: 1;
filter: Alpha(Opacity=100);
}

依此類推,如果您熟悉樂多的CSS結構,便可自行加在任何部份,或者您熟悉CSS語法,也可以多做一些語法變化。

例如,Blog旁邊的欄位條︰

#links a {
text-align: center; /* 設定靠左(left)、置中(center)、靠右(right) */
}
#links a img {
-moz-opacity: 0.5;
opacity: 0.5;
filter: Alpha(Opacity=50);
}
#links a:hover img {
-moz-opacity: 1;
opacity: 1;
filter: Alpha(Opacity=100);
}

教學完畢!


Posted by yam_tony1861 at 樂多Roodo! │14:19 │回應(26)引用(1)╠ CSS
樂多分類:網路/3C 共同主題:美化我的部落格 工具:編輯本文
Ads by Roodo! 

引用URL

http://cgi.blog.roodo.com/trackback/1208548
引用列表:
<div class=\"main\"> <p><font color=\"#80b22b\">如果您跟我一樣有背景圖,但是又不希望文章的圖片擋住背景圖的話&hellip;</font><img align=\"absmiddle\" src=\&q...
圖片連結透明化特效【“一樣的唇,不一樣的眼神" @ DuchessAttic ::PIXNET BLOG::】 at 2008年02月16日 16:00
回應文章
謝謝大大的教學~這語法真的很不錯~
讓我那黑底面版白色的圖片看起來不會那麼唐突~
另外請教~能否讓沒連結的圖片也透明呢?
謝謝你嚕~~~^^
Posted by AFaLa at 2006年05月12日 11:57
http://wwwrergffqafg.host.com
desk3
[url=http://wwwsergffqafg.host.com]desk4[/url]
[link=http://wwwaergffqafg.host.com]desk6[/link]
Posted by Susancww at 2007年12月31日 06:41
Posted by Jasonyvz at 2008年01月10日 01:11
Posted by Kayladdt at 2008年01月10日 16:23
Posted by Kalebfti at 2008年01月11日 01:18
Posted by Gregvxb at 2008年01月11日 07:55
Posted by Rubensii at 2008年01月11日 14:22
Posted by Aidanskf at 2008年01月11日 16:36
Posted by Masonuea at 2008年01月11日 23:17
Posted by Lloydxln at 2008年01月12日 05:00
Posted by Pattyxrb at 2008年01月13日 10:18
Posted by Wendybli at 2008年01月13日 16:07
Posted by Eddiexcj at 2008年01月15日 03:31
Posted by Robinyuh at 2008年01月15日 09:44
Posted by Jeanxfu at 2008年01月16日 21:46
Posted by Paulautu at 2008年01月17日 03:23
Posted by Rogerjdn at 2008年01月17日 15:19
Posted by Averykjg at 2008年01月17日 21:49
Posted by Aidanqxm at 2008年01月18日 03:12
Posted by Nancytoh at 2008年01月20日 08:56
Posted by foot fetish webcam chat at 2008年05月11日 21:33
Hi!gpie! http://ebdjdlxa.com gfyou gglkj http://zmmsdosf.com kuzde oiahx
Posted by Kazelhoa at 2008年07月23日 12:51
Posted by Kazelqoi at 2008年07月23日 12:51
Hi!,
Posted by Qinlctgk at 2008年09月9日 08:24
Posted by Teeth Whitening at 2009年03月30日 12:28
Hi! WmrYkf
Posted by nWBJen at 2009年11月15日 04:09