【问题标题】:Multiple background images not working多个背景图像不起作用
【发布时间】:2018-11-03 11:49:18
【问题描述】:

我正在尝试使用分配给 body 标记的两个不同背景图像。一个在左上角,另一个在右下角。我正在使用以下代码,但它只显示一个或另一个,而不是两者。请协助指出我做错了什么(如果有的话)?我已经在最新版本的 FF 和 Chrome 中进行了测试。

background-image: url(images/bg_top.png), url(images/bg_bottom.png) ; 
background-position: top left, bottom right; 
background-repeat: no-repeat; 
background-attachment: scroll; }`

【问题讨论】:

标签: css image background


【解决方案1】:

试试fixed第二张图片

body{
    background-image: url(https://material.angular.io/assets/img/examples/shiba1.jpg), url(https://i.stack.imgur.com/8DJJX.png) ; 
    background-position: top left, bottom right; 
    background-repeat: no-repeat,no-repeat; 
    background-attachment: scroll, fixed;
    background-size: 150px,150px;
    }

【讨论】:

  • 感谢您的回答,但即使将第二张图像“固定”也不能解决问题。仍然没有显示第二张图片。
  • 试着给他们一个大小background-size: 150px,150px;
  • 给了他们一个大小背景 - 仍然没有显示第二张图片
  • 请检查此路径images/bg_bottom.png
  • 路径没有问题。当我更改周围的图像时,它会在顶部显示另一个图像。由于某种原因,它不允许同时显示两者
猜你喜欢
  • 2023-03-03
  • 2018-05-08
  • 2016-09-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-08-02
相关资源
最近更新 更多