Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Border around search box when you click into it

Tags:

html

css

I found this great CSS for a search box but when I click into the search box, an orange border appears around it (which isn't appealing, lol). If anyone could advice me on how to get rid of the border, it would be greatly appreciated. The CSS is as follows:

#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;
    }

And I've created this JSFiddle for you if it helps: http://jsfiddle.net/nkZ4p/

like image 657
nellygrl Avatar asked Oct 12 '25 15:10

nellygrl


2 Answers

Add outline : none on :focus:

#search input[type="text"]:focus {
    width: 200px;
    outline : none;
}
like image 63
Karl-André Gagnon Avatar answered Oct 14 '25 10:10

Karl-André Gagnon


It is the property of browser. We need to over right this. In chrome its shows orange color and in firefox it shows dotted-line.

you can replace this code to overcome that functions.

#search input[type="text"]:focus {
   width: 200px;
   outline: none;
}
like image 20
Selvamani Avatar answered Oct 14 '25 11:10

Selvamani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!