Set the CSS outline property to none.
input[type="text"], input[type="password"], textarea, select {
outline: none;
}
In cases where the browser may add a background color as well this can be fixed by something like
:focus { background-color: #fff; }
I know in Firefox you can use the attribute autocomplete="off" to disable the autocomplete functionality. If this works in Chrome (haven't tested), you could set this attribute when an error is encountered.
This can be used for both a single element
<input type="text" name="name" autocomplete="off">
...as well as for an entire form
<form autocomplete="off" ...>
this is exactly what your looking for!
// Just change "red" to any color
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px red inset;
}
By using a bit of jQuery you can remove Chrome's styling while keeping the autocomplete functionality intact. I wrote a short post about it here: http://www.benjaminmiles.com/2010/11/22/fixing-google-chromes-yellow-autocomplete-styles-with-jquery/
if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) {
$(window).load(function(){
$('input:-webkit-autofill').each(function(){
var text = $(this).val();
var name = $(this).attr('name');
$(this).after(this.outerHTML).remove();
$('input[name=' + name + ']').val(text);
});
});}
To remove the border for all fields you can use the following:
*:focus { outline:none; }
To remove the border for select fields just apply this class to the input fields you want:
.nohighlight:focus { outline:none; }
You can of course change the border as you desire as well:
.changeborder:focus { outline:Blue Solid 4px; }
(From Bill Beckelman: Override Chrome's Automatic Border Around Active Fields Using CSS)
Yes, it would be a major headache, which in my opinion isnt worth the return. Maybe you could tweak your UI strategy a bit, and instead of coloring the box red, you could color the borders red, or put a small red tape beside it (like the gmails "Loading" tape) which fades away when the box is in focus.
It's a piece of cake with jQuery:
if ($.browser.webkit) {
$("input").attr('autocomplete','off');
}
Or if you want to be a bit more selective, add a class name for a selector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With