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

时间:2022-10-19
本文介绍了输入类型=“按钮"的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 上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一条:如何组合多个 CSS 规则? 下一条:XPath 还是 querySelector?

相关文章

最新文章