html - 具有渐变颜色的背景图像在 chrome 中不起作用

标签 html css

我正在尝试将 webkit 渐变标记与用于 Chrome 的图像一起使用,渐变颜色有效但图像未在 chrome 中显示。我已经在 Firefox 中试过了,图像和渐变颜色效果很好。

background: linear-gradient(to bottom, rgb(74,40,73,.8), 
rgb(147,98,143,.8)), url(./images/covers/1.jpg) no-repeat;  

.profile-card {

	background: linear-gradient(to bottom, rgba(74,40,73,.8), rgb(147,98,143,.8)), url(./images/covers/1.jpg) no-repeat;
  
	background: -webkit-linear-gradient(bottom, #4A2849, #93628F), url(./images/covers/1.jpg) no-repeat;  /* image not working in chrome */
	background-size: cover;
	width: 100%;
	min-height: 90px;
	border-radius: 4px;
	color: #fff;

  }
<div class="profile-card">
          <img src="images/users/user-1.jpg" alt="user" class="profile-photo">
          <h5><a href="#" class="text-white">abc 
        </div><!--profile ends-->

但在 chrome 中我已经尝试过这段代码

background: -webkit-linear-gradient(bottom, #4A2849, #93628F), 
url(./images/covers/1.jpg) no-repeat;

但图像不显示在 chrome 中。

最佳答案

使用 rgba 而不是 rgb,例如:

.a { background: linear-gradient(to bottom, rgba(74,40,73,.8), 
rgba(147,98,143,.8)), url(./images/covers/1.jpg) no-repeat;  
}

.b {
background: -webkit-linear-gradient(bottom, #4A2849, #93628F), 
url(./images/covers/1.jpg) no-repeat;
}
<div class="a">A</div>
<div class="b">B</div>

关于html - 具有渐变颜色的背景图像在 chrome 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47226993/

相关文章:

javascript - 应用程序找不到 wrapbootstrap js 和图像文件

jquery - 如何使 .slideToggle 停止脱离自身

html - CSS3 列 : a better way to add column break

html - 订阅者电子邮件 : GMail is converting height to min-height

javascript - 如果存在覆盖(元素显示 : block) push element underneath down

java - GWT DockLayoutPanel 子控件大小调整

html - 在一个html中加载多个babylon文件

javascript - 如何使用 JS 删除内联 CSS?

php - 阻止从地址栏访问仪表板部分

html - 在可折叠的内部实现 CSS 复选框