如何在 Internet Explorer 10 中隐藏“清除”按钮

警告

已停用、不受支持的 Internet Explorer 11 桌面应用程序在某些版本的 Windows 10 上已通过 Microsoft Edge 更新永久禁用。 有关详细信息,请参阅 Internet Explorer 11 桌面应用停用常见问题解答

本文提供了在 Internet Explorer 10 中隐藏清除按钮的解决方案。

原始产品版本: Internet Explorer 9 及更高版本
原始 KB 编号: 2813492

摘要

Windows Internet Explorer 10 为文本输入字段引入了新的“清除”按钮。 此按钮将在所有呈现模式下显示,但仅当文本输入控件具有焦点且不为空时。 按下后,将清除输入字段。

还有一个名为 的新关联的伪元素 ::-ms-clear 。 此伪元素将一个或多个样式应用于 “清除 ”按钮。 下面的代码示例演示如何使用此伪元素隐藏 “清除 ”按钮:

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <style type="text/css">
            ::-ms-clear {
            ;
            }
        </style>
    </head>
    <body>
        <input type="text" />
    </body>
</html>

上述代码在 Internet Explorer 10 文档模式下按预期工作。

更多信息

当前设计是, “清除 ”按钮将显示在所有 Internet Explorer 10 文档模式中,但样式只能在 Internet Explorer 10 标准文档模式下应用。