如何使背景图像适合div?

时间:2011-11-21 05:42:54

标签: html css internet-explorer

  

可能重复:
  Fit background image to div

如何使背景图像适合div?,因为在Firefox中,没有任何问题,与IE8,IE9不同

这是代码

div.helpcontent{
    height:120px;
    display:none;
    width: 300px;
    position: relative;
    z-index: 1000000;
}


div.helpcontent{
    margin: 0 15px;
    padding: 5px;
    width: 242px;
    text-align: center;
    //background: #ffffff;
    background: url(../images/helpBg.gif) no-repeat;
    border: solid 1px #000000;
}

1 个答案:

答案 0 :(得分:1)

在CSS3中,您可以使用以下css:

div.helpcontent
{
    background:url(../images/helpBg.gif);
    -moz-background-size:100% 100%; /* Firefox 3.6 */
    background-size:100% 100%;
    background-repeat:no-repeat;
    border: solid 1px #000000;
    padding: 5px;
    text-align: center;
}
相关问题