IE 10的-ms-clear伪元素和IE5 quirks模式 [英] IE 10's -ms-clear pseudo-element, and IE5 quirks mode
问题描述
我正在开发一个需要使用Internet Explorer的IE5 Quirks模式(使用 X-UA-Compatible:IE = 5
设置)的旧版网络应用程序。
I'm working on a legacy web app that requires use of Internet Explorer's 'IE5 Quirks Mode' (set using X-UA-Compatible: IE=5
).
应用中的许多文本字段都有(应用程序生成的)x按钮以清除内容。在IE10中,IE还会生成一个x按钮来清除该字段,因此用户看到其中的两个。
A number of text fields in the app have (app-generated) 'x' buttons to clear the content. In IE10, IE also generates an 'x' button to clear the field, so the user sees two of them.
如这个问题,您可以使用<$ c删除IE生成的'x' $ c> :: - ms-clear CSS伪元素。不幸的是,这似乎不工作在IE5怪癖模式: :: - ms-clear
伪元素的样式在开发工具中显示为 :unknown
,并且IE生成的x继续出现。
As discussed in this question, you can remove the IE-generated 'x' using the ::-ms-clear
CSS pseudo-element. Unfortunately, this appears not to work in IE5 Quirks Mode: styling of the ::-ms-clear
pseudo-element shows up in the developer tools as :unknown
, and the IE-generated 'x' continues to appear.
除了重写应用程序以使用现代浏览器模式有没有办法摆脱IE生成的'x'?
Aside from rewriting the app to use a modern browser mode, is there any way to get rid of the IE-generated 'x'?
以下是在IE10下运行IE5 Quirks模式时再现问题的测试页:
Following is a test page that reproduces the problem in IE5 Quirks Mode when run under IE10:
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=5">
<style type="text/css">
::-ms-clear { width: 0; height: 0; }
</style>
</head>
<body>Enter some text:<input></body>
</html>
推荐答案
尝试
input::-ms-clear { display: none; }
或
input::-ms-clear { visibility: hidden; }
一个黑客攻击可能是使用margin-right和overflow属性
A hackier hack might be to use the margin-right and overflow properties
input { margin-right: -20px; overflow: hidden }
这篇关于IE 10的-ms-clear伪元素和IE5 quirks模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!