如何使用 css 更改 Tab 键选择颜色?

emb*_*gal 0 css

当我按下 Tab 键并选择一个按钮时,它会得到一个边框。是否可以使用 css 更改其颜色或完全删除边框?

小智 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>
Run Code Online (Sandbox Code Playgroud)

  • 不鼓励仅使用代码的答案。 (2认同)