【问题标题】:Multiple CSS backgrounds多个 CSS 背景
【发布时间】:2014-06-21 13:17:24
【问题描述】:

我有 3 张背景图片和一种颜色,我想将它们放到模拟网页上,但是我根本无法显示它们,这是我正在使用的 css:

body{
    #FF0,
    url(../Pictures/midal_foot_img_lg.png) bottom center no-repeat,
    url(../Pictures/banner.png) center no-repeat,
    background:url(../Pictures/header2.png) top center no-repeat;
}

【问题讨论】:

标签: html css


【解决方案1】:

我觉得你的语法不对,试试这个:

body {
    background: 
       url(../Pictures/midal_foot_img_lg.png) bottom center no-repeat,
       url(../Pictures/banner.png) center no-repeat,
       url(../Pictures/header2.png) top center no-repeat;
    background-color: #FF0;
}

Source

【讨论】:

  • 背景颜色需要放在最后,否则会被覆盖。要么移动下面的背景颜色声明,要么将#FF0 放在背景值的最后。
【解决方案2】:

Css 属性名必须在值之前。在你的情况下背景。此外,您可能还想查看 Barnee 指出的问题。

   body{
       background:            
       url(../Pictures/midal_foot_img_lg.png) bottom center no-repeat,
       url(../Pictures/banner.png) center no-repeat,
       url(../Pictures/header2.png) top center no-repeat,
       #FF0
   }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-24
    • 2019-08-18
    • 2011-01-29
    • 1970-01-01
    • 2011-01-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多