如何在 MS Edge 和 IE 中隐藏密码输入的眼睛
How to hide the eye from a password input in MS Edge and IE
我现在找到了答案:
当我添加 display: none !important;
时它才有效。我不知道,到底是什么阻止了 display: none;
但如果其他人出现此错误,请尝试添加 !important
并检查输入是否为密码字段。
原题:
我有一个带有自定义添加的“显示密码”按钮的密码输入。现在我想删除由 MS Edge 和 IE 添加的密码按钮。
我已经试过了:
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
display: none;
}
和
input::-ms-reveal,
input::-ms-clear {
display: none;
}
::ms-clear
正在运行并删除了用户可以清除输入的小 x
。但是 ::ms-reveal
不起作用。在 IE 11、基于 Chromium 的 MS Edge 和不基于 Chromium 的最新 MS Edge 中测试。
MS Edge, Chromium based,
IE 11
右边的眼睛是我自定义添加的眼睛,另外一个是IE或者Edge添加的眼睛
这是我的输入样式:
/*
BASIC INPUT STYLING
*/
input, textarea, select {
outline: none;
border-radius: 6px;
box-sizing: border-box;
box-shadow: none;
font-family: 'Roboto', sans-serif;
font-weight: 300;
line-height: 1;
font-size: 16px;
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
color: #222222;
background-color: transparent;
border: 1px solid #CCCCCC;
padding: 18px 22.5px;
transition: border-color .15s ease-in-out;
width: 100%;
}
input:focus, textarea:focus, select:focus {
border: 1px solid #999999;
}
.input-small input, .input-small select, .input-small textarea {
font-size: 14px;
padding: 9px 11.25px;
}
/*
INPUT WITH ICON STYLING
*/
.input-with-icon {
position: relative;
}
.input-with-icon input, .input-with-icon select {
padding-right: 62.5px;
}
.input-with-icon.input-small input, .input-with-icon.input-small select {
padding-right: 32px;
}
.input-icon-div {
height: 51px;
border-radius: 6px;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
width: 40px;
position: absolute;
right: 5px;
bottom: 2px;
cursor: pointer;
}
.input-small .input-icon-div {
font-size: 14px;
height: 27px;
width: 25px;
}
和 HTML:
<div class="input-with-icon">
<input type="password" name="password" id="password" class="" maxlength="255">
<div class="input-icon-div">
<i class="far fa-eye"></i>
</div>
</div>
我试图在 IE 11、MS Edge 旧版浏览器、MS Edge Chromium 浏览器和 Firefox 上测试您的两个代码。
它对我有效,但没有显示显示密码按钮(眼睛)。
测试代码:
<!DOCTYPE html>
<html>
<head>
<style>
input::-ms-reveal,
input::-ms-clear {
display: none;
}
</style>
</head>
<body>
Password: <input type="password" value="" id="myInput" /><br /><br />
</body>
</html>
在 IE 11 浏览器中的输出:
MS Edge 旧版浏览器中的输出:
MS Edge Chromium 浏览器中的输出:
我查看了 documentation 并找到了这个信息。
Non-standard:
This feature is non-standard and is not on a standards
track. Do not use it on production sites facing the Web: it will not
work for every user. There may also be large incompatibilities between
implementations and the behavior may change in the future.
浏览器兼容性仅针对 IE 10 版本显示。
从 92 版开始,当您在字段中键入内容时,它仍然会显示在 Edge 中。根据Edge docs,解是
::-ms-reveal {
display: none;
}
他们还展示了自定义按钮的方法
我现在找到了答案:
当我添加 display: none !important;
时它才有效。我不知道,到底是什么阻止了 display: none;
但如果其他人出现此错误,请尝试添加 !important
并检查输入是否为密码字段。
原题:
我有一个带有自定义添加的“显示密码”按钮的密码输入。现在我想删除由 MS Edge 和 IE 添加的密码按钮。 我已经试过了:
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
display: none;
}
和
input::-ms-reveal,
input::-ms-clear {
display: none;
}
::ms-clear
正在运行并删除了用户可以清除输入的小 x
。但是 ::ms-reveal
不起作用。在 IE 11、基于 Chromium 的 MS Edge 和不基于 Chromium 的最新 MS Edge 中测试。
MS Edge, Chromium based, IE 11
右边的眼睛是我自定义添加的眼睛,另外一个是IE或者Edge添加的眼睛
这是我的输入样式:
/*
BASIC INPUT STYLING
*/
input, textarea, select {
outline: none;
border-radius: 6px;
box-sizing: border-box;
box-shadow: none;
font-family: 'Roboto', sans-serif;
font-weight: 300;
line-height: 1;
font-size: 16px;
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
color: #222222;
background-color: transparent;
border: 1px solid #CCCCCC;
padding: 18px 22.5px;
transition: border-color .15s ease-in-out;
width: 100%;
}
input:focus, textarea:focus, select:focus {
border: 1px solid #999999;
}
.input-small input, .input-small select, .input-small textarea {
font-size: 14px;
padding: 9px 11.25px;
}
/*
INPUT WITH ICON STYLING
*/
.input-with-icon {
position: relative;
}
.input-with-icon input, .input-with-icon select {
padding-right: 62.5px;
}
.input-with-icon.input-small input, .input-with-icon.input-small select {
padding-right: 32px;
}
.input-icon-div {
height: 51px;
border-radius: 6px;
background-color: transparent;
display: flex;
align-items: center;
justify-content: center;
width: 40px;
position: absolute;
right: 5px;
bottom: 2px;
cursor: pointer;
}
.input-small .input-icon-div {
font-size: 14px;
height: 27px;
width: 25px;
}
和 HTML:
<div class="input-with-icon">
<input type="password" name="password" id="password" class="" maxlength="255">
<div class="input-icon-div">
<i class="far fa-eye"></i>
</div>
</div>
我试图在 IE 11、MS Edge 旧版浏览器、MS Edge Chromium 浏览器和 Firefox 上测试您的两个代码。
它对我有效,但没有显示显示密码按钮(眼睛)。
测试代码:
<!DOCTYPE html>
<html>
<head>
<style>
input::-ms-reveal,
input::-ms-clear {
display: none;
}
</style>
</head>
<body>
Password: <input type="password" value="" id="myInput" /><br /><br />
</body>
</html>
在 IE 11 浏览器中的输出:
MS Edge 旧版浏览器中的输出:
MS Edge Chromium 浏览器中的输出:
我查看了 documentation 并找到了这个信息。
Non-standard:
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
浏览器兼容性仅针对 IE 10 版本显示。
从 92 版开始,当您在字段中键入内容时,它仍然会显示在 Edge 中。根据Edge docs,解是
::-ms-reveal {
display: none;
}
他们还展示了自定义按钮的方法