gpt4 book ai didi

php - 无法在图像容器中制作白色背景

转载 作者:行者123 更新时间:2023-11-28 16:33:17 25 4
gpt4 key购买 nike

我需要帮助在边框内制作白色以及黑色描述。

实际场景位于此处:http://buyersstop.blogspot.in/2016/01/motoe.html

我的问题是,如果我应用白色背景颜色,图像周围会出现黑色边框。

div.img1 {
border: 1px solid #777;
}
div.img1:hover {
border: 1px solid #ccc;
}
div.img1 img {
width: 100%;
height: auto;
}
div.desc {
padding: 15px;
text-align: center;
}
* {
box-sizing: border-box;
}
.responsive {
padding: 6px 6px;
float: left;
width: 32.99999%;
}
@media only screen and (max-width: 700px) {
.responsive {
width: 49.99999%;
margin: 6px 0;
}
}
<div class="responsive">
<div class="img1">
<a target="_blank" href="img_fjords.jpg">
<img src="http://ecx.images-amazon.com/images/I/71YgvTPQnKL._SL1500_.jpg" alt="Trolltunga Norway" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
</div>
<div class="responsive">
<div class="img1">
<a target="_blank" href="img_fjords.jpg">
<img src="http://ecx.images-amazon.com/images/I/71YgvTPQnKL._SL1500_.jpg" alt="Trolltunga Norway" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
</div>
<div class="responsive">
<div class="img1">
<a target="_blank" href="img_fjords.jpg">
<img src="http://ecx.images-amazon.com/images/I/71YgvTPQnKL._SL1500_.jpg" alt="Trolltunga Norway" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
</div>
<div class="responsive">
<div class="img1">
<a target="_blank" href="img_fjords.jpg">
<img src="http://ecx.images-amazon.com/images/I/71YgvTPQnKL._SL1500_.jpg" alt="Trolltunga Norway" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
</div>

最佳答案

我对您的代码做了一些修改,请参阅我的更新代码。希望和你想象的一样。

div.img1 {
border: 1px solid #777;
}
div.img1:hover {
border: 1px solid #ccc;
}
div.img1 img {
width: 100%;
height: auto;
}
div.desc {
padding: 15px;
text-align: center;
position: absolute;
bottom: 7px;
color: #fff;
left: 6px;
width: 96%;
background-color: rgba(10,10,10,0.5);
}
* {
box-sizing: border-box;
}
.responsive {
padding: 6px 6px;
float: left;
width: 32.99999%;
position:relative;
background-color:#fff;
}
@media only screen and (max-width: 700px) {
.responsive {
width: 49.99999%;
margin: 6px 0;
}
}
<div class="responsive">
<div class="img1">
<a target="_blank" href="img_fjords.jpg">
<img src="http://ecx.images-amazon.com/images/I/71YgvTPQnKL._SL1500_.jpg" alt="Trolltunga Norway" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
</div>
<div class="responsive">
<div class="img1">
<a target="_blank" href="img_fjords.jpg">
<img src="http://ecx.images-amazon.com/images/I/71YgvTPQnKL._SL1500_.jpg" alt="Trolltunga Norway" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
</div>
<div class="responsive">
<div class="img1">
<a target="_blank" href="img_fjords.jpg">
<img src="http://ecx.images-amazon.com/images/I/71YgvTPQnKL._SL1500_.jpg" alt="Trolltunga Norway" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
</div>
<div class="responsive">
<div class="img1">
<a target="_blank" href="img_fjords.jpg">
<img src="http://ecx.images-amazon.com/images/I/71YgvTPQnKL._SL1500_.jpg" alt="Trolltunga Norway" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
</div>

关于php - 无法在图像容器中制作白色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34978222/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com