Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 所有浏览器中的按钮高度相同_Html_Css_Styling - Fatal编程技术网

Html 所有浏览器中的按钮高度相同

Html 所有浏览器中的按钮高度相同,html,css,styling,Html,Css,Styling,似乎每个浏览器中的按钮样式都不同。我特别尝试让所有浏览器中的所有按钮高度相同。我尝试了许多不同的建议和帖子,但我无法得到任何有用的东西。我需要它在IE8+、Chrome和Firefox中保持一致。这也是我正在使用的当前doctype: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 这在chrome中是有效的,但

似乎每个浏览器中的按钮样式都不同。我特别尝试让所有浏览器中的所有按钮高度相同。我尝试了许多不同的建议和帖子,但我无法得到任何有用的东西。我需要它在IE8+、Chrome和Firefox中保持一致。这也是我正在使用的当前doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
这在chrome中是有效的,但firefox和IE似乎对此没有反应(可能是因为他们严格执行了特定的doctype?)

我知道有一种jquery方法,但我不想检查在每次回发时调用哪个浏览器来设置它们的样式


如果有人在css中有一个银弹,那将是最佳的,但我愿意接受一个最低限度的javascript方法,如果有的话。

不应该有这个问题:

input[type="button"], 
input[type="submit"], 
input[type="reset"], 
input[type="file"], 
button {
    height:30px; //Don't use the !important keyword if you can help it!
    box-sizing: border-box; //Makes working with dimensions a bit easier
}

您是否尝试设置
高度
而不是
行高度
?是。。。firefox和ie没有响应allI see的选择器。。。如果我从选择器中删除
input[type=“file”]::-webkit file upload按钮,
,您的CSS似乎在所有这三种浏览器中都设置了一个按钮的样式(使用
height
)。也许您需要为特定于webkit的选择器创建一个“私有”规则?
input[type="button"], 
input[type="submit"], 
input[type="reset"], 
input[type="file"], 
button {
    height:30px; //Don't use the !important keyword if you can help it!
    box-sizing: border-box; //Makes working with dimensions a bit easier
}