当站点在本地主机上时,这种css样式在所有浏览器上都能完美地工作。但当我将网站上传到实时服务器上时,它也可以在除IE之外的所有浏览器上运行。
背景图像不显示。
.button {
font-family:Arial, Helvetica, sans-serif;
display:inline-block;
position:relative;
background:url(../images/button-bg.gif) 0 0 repeat-x #3b3d3e;
border:1px solid #3b3d3e;
font-size:11px;
color:#fff;
font-weight:bold;
text-decoration:none;
padding:1px 9px;
margin-right:7px;
border-radius:2px;
-moz-border-radius:2px;
-webkit-border-radius:2px;
behavior:url(js/PIE.htc);
}注意:正如您所看到的,我使用颜色#3b3d3e作为背景,当页面加载时,我看到这个颜色有一瞬间,然后它就消失了。
这有什么问题呢?
发布于 2013-05-15 03:27:36
我认为背景应该按如下顺序写出来:背景:颜色、位置、大小、重复原点、剪辑、附件图像;也许IE是唯一关心的浏览器?
如果这不起作用,可以尝试分别添加所需的每个背景值:背景颜色、背景位置、背景大小、背景重复、背景原点、背景剪辑、背景附件和背景图像。
另外,您可能希望注释掉css "behavior:url(js/PIE.htc)“中的最后一行。我知道有时这些东西会与其他属性发生冲突。我自己从来没有用过派,但值得一试。
发布于 2013-05-15 03:21:30
颜色优先:
background: #3b3d3e url(../images/button-bg.gif) 0 0 repeat-x;发布于 2013-05-15 03:44:02
尝试向.button添加zoom:1
这将触发IE7上的hasLayout属性。详细解释在这里:On having Layout
https://stackoverflow.com/questions/16551086
复制相似问题