在input获取焦点时,采用css将文本框的外边框去掉
2019-07-15阅读:2500
问题:文本框获取焦点时,浏览器给采用默认的处理方式,为其加上高亮外边框。
解决思路:
我们可能通过,在input获取焦点时,采用css将文本框的外边框去掉。为文本框添加如下样式即可:outline:none;
样式代码:
input:focus {outline:none;}
下面给出一个完成的示例代码:
<html>
<head>
<style>
form{background-color : #FF00F1F;height:50px;padding : 15px;}
.inputStyle, .inputStyle:focus {outline:none;}
</style>
</head>
<body>
<div id="dh2">
<form>
<input type="text" class="inputStyle"/>
<input type="text" />
</form>
</div>
</body>
</html>
解决思路:
我们可能通过,在input获取焦点时,采用css将文本框的外边框去掉。为文本框添加如下样式即可:outline:none;
样式代码:
input:focus {outline:none;}
下面给出一个完成的示例代码:
<html>
<head>
<style>
form{background-color : #FF00F1F;height:50px;padding : 15px;}
.inputStyle, .inputStyle:focus {outline:none;}
</style>
</head>
<body>
<div id="dh2">
<form>
<input type="text" class="inputStyle"/>
<input type="text" />
</form>
</div>
</body>
</html>