問題描述
我正在處理一個(gè)大表單,它在整個(gè)表單中包含很多按鈕,因此我試圖在我的主 css 文件中獲取有效的 input[type="button"] 以便它可以捕獲所有按鈕必須為每個(gè)單獨(dú)的類添加一個(gè)類,由于某種原因,這在 IE7 上不起作用,在網(wǎng)上檢查后說 IE7 應(yīng)該支持這一點(diǎn).
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" 因?yàn)椴⒎撬邪粹o都會(huì)提交表單.
Also it has to be type="button" and not type="submit" as not all buttons will submit the form.
誰能提示我做錯(cuò)了什么?
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.
這篇關(guān)于輸入類型=“按鈕"的CSS屬性選擇器無法在 IE7 上運(yùn)行的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!