去除input默认边框和选中时的框框

添加两个样式:

input {
     border:0 none;
     outline:none;
}

解释:

去除边框比较简单,直接border:0 none;。

去除input选中时的样式,首先观察它到底是什么:

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>1.0</title>
 6     <style>
 7         * {
 8             margin:0;
 9             padding:0;
10         }
11         input {
12             border:13px solid red;
13         }
14     </style>
15 </head>
16 <body>
17     <input type="text" placeholder="请输入姓名">
18 </body>
19 </html>
View Code

把边框放大观察,发现:当input选中时,出现的框框在border外边,即设置元素周围的轮廓outline。

最后,直接outline:none;。

持续的输入与输出。
原文地址:https://www.cnblogs.com/qhm-1440/p/14191453.html