Kaie"s Blog 2.0 beta!
Back to "Top"

My Secret Notebook
 Show "Table of Contents"
Contact Me
Subscribe to my Posts feed
Subscribe to my Comments feed
My Flickr
Back to "Top"
My Secret Notebook
 Show "Table of Contents"
Contact Me
Subscribe to my Posts feed
Subscribe to my Comments feed
My Flickr

Sunday, March 11, 2007

[CSS] hideFocus Property

如何避免超連結在點選時會出現"虛線外框"呢?! 因為我的Blog裡有一些由圖片組成的"Navigation Icon"及"Navigatin Bar"...所以一當點選此類連結時,便會出現預設的"虛線外框(如下圖)",個人覺得那虛線相當的礙眼...XD,破壞整個美感!!
若你跟我有相同感受的話,那你就跟著底下作吧... :p

有底下兩種作法:
1. 針對單一超連結的作法: 加上 hidefocus="true" 屬性 (For IE only)
Example:<a href="http://www.google.com" hidefocus="true">Google</a>

2. 透過CSS的作法 (For IE & Firefox )
Example:<style>
a {noFocusLine:expression(this.onFocus=this.blur())} /* For IE, onFocus 的 F 要大寫*/
:focus {-moz-outline-style: none} /* For Firefox */
</style>

※若是使用Blogger的話,那就將方法2.的code加在</head>的上方即可 ^_^,若是別的Blog平台請自行摸索啦…

[UPDATE 2009/05/22] 資料來源 : http://www.wowbox.com.tw/blog/article.asp?id=3310

<style type="text/css">  
.wrap{position:relative;}
.btns{zoom:1;}
.btns *{outline:0;zoom:1;background:#f2f2f2;}
.btns button::-moz-focus-inner{border-color:transparent!important;}
</style>
<div class="wrap">
<div class="btns">
<button type="button">確定</button><button type="button">取消</button>
<a href="#">確定</a><a href="#">取消</a>
</div>
</div>

6 Comments:

Who: address Class:
When: December 14, 2007 12:06 PM  

感謝~~

Who: Tsung-Kai Chen Class:
When: December 14, 2007 2:14 PM  

To address:
You are welcome..^_^

Who: Let it be Class:
When: December 26, 2007 3:52 AM  

Thank U! MERRY XMAS:)

Who: Daniel Cruz Class:
When: January 23, 2008 11:29 PM  

Costa Rica is a country with a extremely sense of freedom. The landscapes are for much the most green in whole center america.The chances of investement are way to high, the average of Americans, European and people of the entire planet who is buying here is up in the sky !!!
Great investment opportunity in Costa Rica: condos, costa rica real estate, costa rica property. Visit us for more info at: http://www.jaco-bay.com/

Who: 小瑞 Class:
When: March 04, 2009 1:43 PM  

謝謝你
讓我解決了那個很頭痛的虛線

Who: Tsung-Kai Chen Class:
When: March 06, 2009 10:14 PM  

To 小瑞:
哈哈...拿去用吧!