我想创建一个半透明的颜色层,我想在其中输入图像的标题和描述,但由于某种原因,我无法进行更改或实现我的目标。谁能帮我解决这个问题?我无法将透明层覆盖在图像上,因为它在同一张卡上。
我想创建如下图:
我的 HTML 代码在这里:
.container{
max-width: none;
}
.container-fluid, .container-sm, .container-md, .container-lg, .container-xl {
padding-right: 0;
padding-left: 0;
}
.card {
padding: 10px 0 0 0 !important;
}
section {
overflow: hidden;
}
.row {
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin-right: -15px;
margin-left: -15px;
}
[data-aos^=fade][data-aos^=fade].aos-animate {
opacity: 1;
transform: translateZ(0);
}
.card .entry {
padding: 20px;
margin-bottom: 60px;
overflow: hidden;
box-shadow: 10px 10px 5px grey;
background: #ea8537;
}
.entry:hover{
background: #ffcc00;
transition: 1.2s;
transform: scale(1.01);
}
article, aside, figcaption, figure, footer, header, hgroup, main, nav, section {
display: block;
}
*, ::after, ::before {
box-sizing: border-box;
}
.card .entry .entry-img {
max-height: 400px;
margin: -20px -20px 20px -20px;
overflow: hidden;
z-index: -1;
}
.img-fluid {
width: 100%;
height: auto;
}
img {
vertical-align: middle;
border-style: none;
}
.img:hover{
opacity: 0.6;
}
.card .entry .entry-title {
font-size: 20px;
line-height: 26px;
font-weight: bold;
padding: 0;
margin: 0 0 20px 0;
}
.card .entry .entry-title a {
color: #FFFFFF;
transition: 0.3s;
}
.card .entry .entry-content a {
color: #FFFFFF;
transition: 0.3s;
}
.card .entry .entry-meta {
margin-bottom: 15px;
color: #000;
}
.align-items-stretch {
align-items: stretch !important;
max-width: 100%;
}
<section id="card" class="card">
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-6 d-flex align-items-stretch" data-aos="fade-up">
<article class="entry">
<div id="img1" type="image" class="entry-img">
<img src="" alt="" class="img-fluid">
</div>
<h2 class="entry-title">
<a href="">
<div id="txt1" type="text"></div>
</a>
</h2>
<div class="entry-content">
<p>
<div id="txt2" type="text"></div>
</p>
</div>
</div>
</div>
</div>
</section>