2013-06-03 22 views
2

我發現了這個很棒的搜索框的CSS,但是當我點擊搜索框時,它周圍會出現一個橙色邊框(這不是吸引人的,哈哈)。如果任何人可以建議我如何擺脫邊界,將不勝感激。該CSS如下:當你點擊進入時搜索框的邊框

#search input[type="text"] { 
    background: url(search-white.png) no-repeat 10px 6px #fcfcfc; 
    border: 1px solid #d1d1d1; 
    font: bold 12px Arial,Helvetica,Sans-serif; 
    color: #bebebe; 
    width: 150px; 
    padding: 6px 15px 6px 35px; 
    -webkit-border-radius: 20px; 
    -moz-border-radius: 20px; 
    border-radius: 20px; 
    text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1); 
    -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset; 
    -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset; 
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset; 
    -webkit-transition: all 0.7s ease 0s; 
    -moz-transition: all 0.7s ease 0s; 
    -o-transition: all 0.7s ease 0s; 
    transition: all 0.7s ease 0s; 
    } 

#search input[type="text"]:focus { 
    width: 200px; 
    } 

而且我創造了這個的jsfiddle對您是否有幫助:http://jsfiddle.net/nkZ4p/

回答

7

:focus添加outline : none

#search input[type="text"]:focus { 
    width: 200px; 
    outline : none; 
} 
+0

非常感謝玩具!訣竅! – nellygrl

0

See this question - 它實際上不是border這是outline。使用刪除它:

#search input[type="text"]:focus { 
    outline: none; 
} 
0

我有一個藍色邊框,我想這取決於你用什麼瀏覽器。您可以通過添加以下css刪除它:outline:none;

0

它是瀏覽器的性能。我們需要糾正這一點。在鉻顯示橙色,並在Firefox中顯示虛線。

您可以替換此代碼以克服該功能。

#search input[type="text"]:focus { 
    width: 200px; 
    outline: none; 
}