【发布时间】:2020-08-10 15:36:40
【问题描述】:
我有一个将背景图像放入 div 的代码,但是当我使用 opacity 时,所有 div 都会受到影响,即使其中的文本是我的代码;
.banner_area .banner_inner {
opacity: .5;
position: relative;
overflow: hidden;
width: 100%;
min-height: 395px;
background: url(../img/breadcrumb/checkout-bg.jpg) no-repeat center bottom;
background-size: cover;
z-index: 1; }
我试过background: rgba(0, 0, 0, 0.6);,但我的图片没有显示
我也试过background: linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,.5)), url(../img/breadcrumb/checkout-bg.jpg);,但它不起作用
【问题讨论】:
-
你能发布 HTML 吗?现在,您正在尝试选择一个
.banner_area的 child,其类为banner_inner。这就是你想要做的吗?