输入类型=“按钮"的CSS属性选择器无法在 IE7 上运行

Css attribute selector for input type=quot;buttonquot; not working on IE7(输入类型=“按钮的CSS属性选择器无法在 IE7 上运行)
本文介绍了输入类型=“按钮"的CSS属性选择器无法在 IE7 上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在处理一个大表单,它在整个表单中包含很多按钮,因此我试图在我的主 css 文件中获取有效的 input[type="button"] 以便它可以捕获所有按钮必须为每个单独的类添加一个类,由于某种原因,这在 IE7 上不起作用,在网上检查后说 IE7 应该支持这一点.

I am working on a big form and it contains a lot of buttons all over the form, therefore I am trying to get working input[type="button"] in my main css file so it would catch all buttons with out having to add a class to every single one, for some reason this is not working on IE7, after checking on the web it says that IE7 should be supporting this.

还必须是 type="button" 而不是 type="submit" 因为并非所有按钮都会提交表单.

Also it has to be type="button" and not type="submit" as not all buttons will submit the form.

谁能提示我做错了什么?

Could anybody give a hint what am I doing wrong?

input[type="button"] {
    text-align:center;
}

我也试过 input[type=button]

推荐答案

我很难让 input[type=button] 选择器在 IE7 或 IE8 中工作.问题原来是 HTML 页面缺少!DOCTYPE"声明.一旦我添加了

I was struggling getting input[type=button] selectors working in IE7 or IE8. The problem turned out to be that the HTML Pages were missing a "!DOCTYPE" declaration. Once I added

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

然后一切正常.您显然可以使用不同的!DOCTYPE"声明来满足您的要求.

Then everything worked fine. You can obviously use a different "!DOCTYPE" declaration to suit your requirements.

这篇关于输入类型=“按钮"的CSS属性选择器无法在 IE7 上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Authorization header in img src link(img src 链接中的授权标头)
:hover:before text-decoration none has no effects?(:hover:before text-decoration none 没有效果?)
Is CSS faster when you are specific?(当您特定时,CSS 会更快吗?)
CSS sibling selectors (select all siblings)(CSS 兄弟选择器(选择所有兄弟))
IE: nth-child() using odd/even isn#39;t working(IE:使用奇数/偶数的 nth-child() 不起作用)
How can I tell if an element is in a shadow DOM?(如何判断一个元素是否在影子 DOM 中?)