在Internet Explorer8中,我无法正确显示输入中的文本。Firefox、Safari和Chrome都显示相同的内容。
Firefox、Safari和Chrome

Internet Explorer 8

<form action="" method="get">
<input id="q" name="q" type="text">
<input id="s" name="s" type="submit" value="Sök">
</form>
#q {
background:url(../../image_layout/search_field.png) no-repeat;
width:209px;
height:32px;
padding:0 5px 0 5px;
text-align:left;
margin:0;
border:0;
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
font-weight:bold;
color:#09305b;
font-weight:bold;
position:absolute;
left: 0px;
top: 19px;
}
#s {
background:url(../../image_layout/serach_buttom.png) no-repeat;
width:56px;
height:34px;
padding:0;
margin:0;
color:#FFFFFF;
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
font-weight:bold;
border:0;
position:absolute;
left: 225px;
top: 17px;
}发布于 2011-03-10 19:09:36
尝试指定line-height: 34px或类似的内容。
发布于 2013-02-14 22:07:18
有一个CSS3规则:box-sizing。IE8支持此规则。
IE(包括IE8)有非标准的盒子模型,其中padding和border包含在width和height中,而其他浏览器使用标准,不包含宽度的填充和边框。它在here中有详细的描述。
通过将box-sizing设置为content-box,您可以告诉浏览器不要在宽度中包含边框和填充,如果设置为box-sizing: border-box,则所有浏览器都将在宽度中包含边框和填充。这样或那样,显示将在所有现代浏览器上保持一致(并不是说IE8很现代,但它也支持这一规则:)。
发布于 2012-06-19 21:50:20
我必须设置行高和display: inline。不知道为什么,但它对我很有效。
https://stackoverflow.com/questions/5258802
复制相似问题