2011-05-20 81 views
0

我遇到了几个与我的背景没有显示的按钮元素有关的问题。Internet Explorer问题和背景未显示

这里是我的CSS代码:

button.button-master-lite, a.button-master-lite { 
    background: #92AE41; 
    background: -moz-linear-gradient(top, #89A73E 0%, #92AE41 100%); 
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#89A73E), to(#92AE41)); 

    border: 1px solid #89A73E; 
    border-bottom: 1px solid #92AE41; 

    -moz-border-radius: 3px; 
    -webkit-border-radius: 3px; 
    border-radius: 3px; 

    -moz-box-shadow: inset 0 1px 0 0 #92AE41; 
-webkit-box-shadow: inset 0 1px 0 0 #92AE41; 
    box-shadow: inset 0 1px 0 0 #92AE41; 

    color: #fff; 
    font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; 
font-size: 11px; 
    font-weight: bold; 
    line-height: 1; 

    padding: 5px 8px 6px 8px; 
    text-align: center; 
    text-shadow: 0 -1px 0 #5D862F; 
    width: auto; 
} 

这是我的HTML:

<a class="button-master-lite" href="#">Order Now</a> 

与IE 6和IE 7中的背景颜色不显示。但是,当我除掉第一个背景声明后,背景显示。

我有这个按钮的HTML页面上有一些div和子divs与浮动和位置样式元素,但我不明白哪一个是造成问题。我试着把代码放在一个完全空白的页面上,只有我的样式表,它工作正常。

有什么特别的东西会导致背景不显示,当我有其他浏览器的其他背景声明?它与浮标或其他定位元素有什么关系?

我希望得到一些帮助。谢谢。

+0

对于它的价值,你可以结合你的字体家庭,字体大小,字体重量和行高规则转换为[单个声明]:'font:bold 11px/font-weight, 1“Lucida Grande”,“Lucida Sans Unicode”,“Lucida Sans”,日内瓦,Verdana,sans-serif;' – sdleihssirhc 2011-05-20 18:29:54

回答

1

尝试像这样:

button.button-master-lite, a.button-master-lite { 
    background-color: #92AE41; 
    background-image: -moz-linear-gradient(top, #89A73E 0%, #92AE41 100%); 
    background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#89A73E), to(#92AE41)); 
    border: 1px solid #89A73E; 
    border-bottom: 1px solid #92AE41; 
    -moz-border-radius: 3px; 
    -webkit-border-radius: 3px; 
    border-radius: 3px; -moz-box-shadow: inset 0 1px 0 0 #92AE41; 
    -webkit-box-shadow: inset 0 1px 0 0 #92AE41; 
    box-shadow: inset 0 1px 0 0 #92AE41; 
    color: #fff; 
    font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif; 
    font-size: 11px; 
    font-weight: bold; 
    line-height: 1; 
    padding: 5px 8px 6px 8px; 
    text-align: center; 
    text-shadow: 0 -1px 0 #5D862F; 
    width: auto; 
} 
+0

谢谢。这工作。 – 2011-05-20 23:48:41

0

使用的背景颜色和背景图像属性添加display:blockdisplay:inline-block

+0

不知道为什么我得到了downvote?它可能是一个可能的属性,他可能错过了,并导致背景不显示,因为锚标签是内联元素 – breezy 2011-05-20 18:45:51

+1

我猜你是downvoted,因为他谈论的*颜色*没有显示。显示块或内联与此无关。 – NotMe 2011-05-20 18:48:43

+1

我提高了评论。虽然这个问题可能是关于颜色没有显示,但显示属性可以并确实对这些事情有影响,尤其是对于非块级元素(如“a”标记)... – 2011-05-20 19:06:50