CSS 从 IE10 中删除清除和显示密码图标

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17000562/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 23:09:27  来源:igfitidea点击:

Removing clear and reveal password icons from IE10

cssinternet-explorer

提问by user2425833

I have this design where the user inputs some text in input type=textand it is validated via jQuery. Now when user inputs some data, IE10 shows an Xsign to clear text box however, by design it overlaps the custom designed Ximage and also the eye icon overlaps the custom design of the password field.

我有这样的设计,用户在其中输入一些文本input type=text并通过 jQuery 进行验证。现在,当用户输入一些数据时,IE10 会显示一个X清除文本框的标志,但是,通过设计它与自定义设计的X图像重叠,并且眼睛图标与密码字段的自定义设计重叠。

I've tried using ::-ms-clearfor input type=textand ::-ms-revealfor input type=passwordbut unfortunately, it does nothing at all. I have read that reveal can only be removed by disabling it from somewhere in system which is of no use.

我试过使用::-ms-clearforinput type=text::-ms-revealforinput type=password但不幸的是,它什么也没做。我已经读过,揭示只能通过从系统中某个没有用的地方禁用它来删除。

Can anyone please help me or direct me to fix this issue or tell me how this issue can be solved?

任何人都可以帮助我或指导我解决此问题或告诉我如何解决此问题?

回答by ndunk28

The following CSSworked for me

以下CSS对我有用

input::-ms-clear, input::-ms-reveal {
    display: none;
}

See ::-ms-clearand ::-ms-revealfor extra information.

请参阅::-ms-clear::-ms-reveal以获取更多信息。

回答by AdamCrawford

Two questions. First, are you sure your CSS is correct as the following CSS works for me:

两个问题。首先,您确定您的 CSS 是正确的,因为以下 CSS 对我有用:

::-ms-reveal {
    display: none;
}

Second question: Are you running IE10 in IE9 mode or below under Developer Tools. If so, this selector doesn't appear to work and IE10 still inserts the password eye. I'm looking for a resolution to that issue now.

第二个问题:您是否在开发人员工具下以 IE9 或以下模式运行 IE10。如果是这样,这个选择器似乎不起作用,IE10 仍然插入密码眼。我现在正在寻找该问题的解决方案。

回答by mmaynar1

The answers given are good solutions when you are not running in compatibility mode. This should work great:

当您不在兼容模式下运行时,给出的答案是很好的解决方案。这应该很好用:

::-ms-reveal 
{
    display: none;
}

Unfortunately there are few good solutions when you are running in compatibility mode. As you can see here, those css selectors do not work in compatibility mode: https://connect.microsoft.com/IE/feedback/details/783743

不幸的是,当您在兼容模式下运行时,很少有好的解决方案。正如您在此处看到的,这些 css 选择器在兼容模式下不起作用:https: //connect.microsoft.com/IE/feedback/details/783743

You could try something like covering it with an image. Depending on the the context of how your application is used and how many people you need to roll it out to, you could also edit the registry to disable the reveal/clear features in IE. You can do that like so:

您可以尝试使用图像覆盖它。根据您的应用程序如何使用的上下文以及您需要将其推广到多少人,您还可以编辑注册表以禁用 IE 中的显示/清除功能。你可以这样做:

  1. Open Notepad.exe
  2. Add this to the file:

    Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Main] "DisablePasswordReveal"=dword:00000001

  3. Save it as DisablePwPeekW7.reg

  4. Double click the file you just made, accept. Login and verify.

  1. 打开记事本.exe
  2. 将此添加到文件中:

    Windows 注册表编辑器 5.00 版 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Main] "DisablePasswordReveal"=dword:00000001

  3. 将其另存为 DisablePwPeekW7.reg

  4. 双击刚刚制作的文件,接受。登录并验证。

See here for more info: https://superuser.com/questions/578611/remove-eye-symbol-from-windows-7-ie10-password-field

请参阅此处了解更多信息:https: //superuser.com/questions/578611/remove-eye-symbol-from-windows-7-ie10-password-field