Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS - Removing input field active highlight

Using only html and css, how do I disable the blue (in Firefox) highlight color around an active input field. I've tried using input {outline:none;} but with no success. Thanks for the help! =)

ok,ignoring the previous code about outline, I chose the wrong property to change. What I'm trying to get is to simply remove the highlighting (whatever browser, its the bold and colored border that appears) around an active form input field, without changing or disabling the styling. Thanks =)

like image 279
Kizer Yakuza Avatar asked Mar 16 '13 19:03

Kizer Yakuza


People also ask

How do you remove input field focus?

The blur() method removes focus from an element.

How do I get rid of blue highlight in CSS?

Answer: Use the CSS ::selection pseudo-element By default, when you select some text in the browsers it is highlighted normally in blue color. But, you can disable this highlighting with the CSS ::selection pseudo-element.


3 Answers

You have to use :focus declaration. In this case:

input:focus {outline:none;} 

All the input's in your project won't have the blue border.

If you want a specific attribute, use this:

input[type=text]:focus {outline:none;} 

Hope it helps. =)

like image 140
Paula Fleck Avatar answered Oct 26 '22 09:10

Paula Fleck


See this fiddle.

It seems that you have to set some border property to make outline: none work. If you comment in the border directive, the outline disappears.

like image 40
ohcibi Avatar answered Oct 26 '22 08:10

ohcibi


input {border:0; outline:none;}

should remove all borders/outlines.

like image 32
Alex Shesterov Avatar answered Oct 26 '22 09:10

Alex Shesterov