当我单击按钮的文本时,提交输入在 IE8 中未获得 :active 状态
在 IE8 中,如果我准确单击提交按钮上的文本值,它不会从 input:active
CSS 选择器获取属性。
但如果我点击按钮上的其他地方,它就会得到它们。
为什么?我该如何解决?
In IE8 if I click exactly on the text-value on a submit button, it doesn't get the properties from the input:active
CSS selector.
But if I click elsewhere on the button it gets them.
Why? How can I solve it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以通过将
input:focus
应用于input:active
选择器声明来实现此目的:应用
:active
和:focus
在一起对于 ui/ux/etc 来说非常有用......很多东西。you can achieve this by applying
input:focus
to yourinput:active
selector declaration:applying
:active
and:focus
together are great for ui/ux/etc.... a lot of things.这真的很有趣,我以前从未注意到这一点。 IE9 执行相同的操作:单击文本,并且不应用
:active
样式。单击文本外部,它们就出现了。IE 6 和 7 存在一个问题,如果按钮有大量文本,则按钮的边缘会绘制成锯齿状。可以通过对按钮应用
overflow:visible
来解决此问题< /a>.但这似乎对这个问题没有任何影响。我还尝试应用
zoom: 1
来提供按钮布局(尽管我认为表单控件已经有了布局),但这也没有效果。不幸的是,似乎没有针对此问题的 CSS 解决方法。
That’s really interesting, I’d never noticed that before. IE9 does the same thing: click on the text, and the
:active
styles aren’t applied. Click outside the text, and they are.IE 6 and 7 had a problem where the edges of buttons would be drawn jaggedly if the button had a lot of text. This can be fixed by applying
overflow: visible
to the button. That doesn’t seem to have any effect on this problem though.I also tried applying
zoom: 1
to give the button layout (although I think form controls already have layout), but that had no effect either.Unfortunately, it looks like there isn’t a CSS workaround for this issue.
太棒了,感谢 Albert 提到
:focus
选择器。我花了几个小时寻找“点击率”问题的解决方案,但没有找到好的信息。我的问题与OP类似,但问题是链接而不是输入按钮。
基本上,我有一个多行链接/按钮,在 IE 中,不可能仅使用链接上的
:active
选择器来更改按钮的属性,因为a
不会“闪耀”。现在,我在
a
上使用a:active
和a:focus
以及onclick="this.blur();"
对于我的目的来说,它就像一个魅力。请看看我在 jsFiddle 上的解决方案: http://jsfiddle.net/pezzi/UzARF/
Great, thanks Albert for mentioning the
:focus
selector. I was looking for a solution to the 'clickthrough' problem for a couple of hours now, without finding good information.My problem was a similar one to OP but for a link instead of input button.
Basically, I have a multiline link/button and in IE it was not possible to only use the
:active
selector on the link to change the button's properties since thespan
inside thea
would not 'shine' through.Now, I use
a:active
anda:focus
on thea
together withonclick="this.blur();"
and it works like a charm for my purposes.Please have a look at my solution on jsFiddle: http://jsfiddle.net/pezzi/UzARF/
:active
选择器 edit 在 IE 中 /edit 用于选择活动链接(锚点)元素并为其设置样式,不输入。使用 Javascript 将焦点事件附加到您的按钮。
:active
selector edit in IE /edit is used to select and style the active link (anchor) element, not input.Use Javascript to attach on focus event to your button.