When I press tab key and select a button it gets a border. Is it possible to change its color or remove the border completely with css?
Asked
Active
Viewed 9,420 times
0
-
4You can do `outline: none` and it will fix it but I'd urge you to keep it as-is (unless you have some other visible distinction) because there may be users who aren't using the mouse and this outline will let them know which item is focussed. Have a look at this - http://outlinenone.com/ – Harry Jun 03 '16 at 12:13
-
2Yes, you can override `:focus` and `:active` styles in css. – Mohammad Usman Jun 03 '16 at 12:13
-
thanks, `outline:none` worked correctly – embergal Jun 03 '16 at 12:15
1 Answers
5
<!DOCTYPE html>
<html>
<head>
<style>
input:focus {
background-color: yellow;
}
</style>
</head>
<body>
<p>Click inside the text fields to see a yellow background:</p>
<form>
First name: <input type="text" name="firstname"><br>
Last name: <input type="text" name="lastname">
</form>
<p><b>Note:</b> For :focus to work in IE8, a DOCTYPE must be declared.</p>
</body>
</html>

Alper Şaldırak
- 1,034
- 8
- 10