【问题标题】:CSS error: background image display problemCSS错误:背景图片显示问题
【发布时间】:2023-04-07 03:36:02
【问题描述】:

两个背景图片:

https://www.marsha.com.hk/libs/img/Slim-landing%20banner1906x810-03.jpg

https://www.marsha.com.hk/libs/img/V-face-landing%201906x810_R1-02.jpg

您可以在浏览器中打开每一个。 我可以显示第一个图像,但第一个被第二个 URL 替换,它没有。

<!DOCTYPE html>
<html>

<head>
  <title></title>
</head>

<body>

  <div style="background-image:url(https://www.marsha.com.hk/libs/img/Slim-landing%20banner1906x810-03.jpg);  
    	   height: 330px;
    	   background-position: center;
    	  background-repeat: no-repeat;
    	  background-size: cover;
    	  position: relative" class="item2" data-aos="fade-up">
  </div>
</body>

</html>

【问题讨论】:

  • 什么时候需要更换??不清楚..
  • 替换网址
  • 你用js还是jquery?你有按钮吗?
  • 上面的代码
  • @ChSunrain 请接受 John 的回答,这样我们就可以看到您在这个问题上不再需要帮助了。

标签: html css


【解决方案1】:

如果你想显示完整的背景,请使用
background-size: contain
也尝试设置
width: 100%

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-06
    • 2010-12-12
    相关资源
    最近更新 更多