css - 谁能告诉我如何使用 bootstrap/CSS 在图像上制作边框?
问题描述
这是图像。我已经制作了 UI,但在制作边框时需要帮助,因为它在图像中给出
<div>
<img class='image1' src='https://www.w3schools.com/w3css/img_lights.jpg' />
<img class='image2' src='https://www.w3schools.com/w3css/img_lights.jpg' />
</div>
CSS
div {
text-align: center
}
.image1 {
border: 15px solid seagreen;
outline: 15px solid green;
width:'150px';
height:'150px';
border-radius: 75%
}
.image2 {
border: 15px solid seagreen;
position: relative;
right:25px;
width:'150px';
height:'150px';
border-radius: 75%
}
解决方案
您提供的代码稍作修改。
.parent-div {
margin-top: 100px;
}
div {
text-align: center;
}
.image1 {
border: 15px solid seagreen;
width: 150px;
height: 150px;
border-radius: 75%;
border-right-color: transparent;
}
.image2 {
border: 15px solid seagreen;
position: relative;
right: 80px;
width: 150px;
height: 150px;
border-radius: 75%;
border-left-color: transparent;
}
.imageH {
width: 150px;
height: 150px;
border-radius: 75%;
}
.ib {
display: inline-block;
}
.left-img {
position: relative;
z-index: -15;
width: 175px;
height: 175px;
border: 20px solid seagreen;
border-radius: 75%;
top: -200px;
left: 17px;
opacity: 0.3;
}
.right-img {
left: -100px;
opacity: 0.3;
position: relative;
z-index: -15;
width: 175px;
height: 175px;
border: 20px solid seagreen;
border-radius: 75%;
top: -200px;
}
<div class="parent-div">
<img class="image1" src="https://www.w3schools.com/w3css/img_lights.jpg" />
<img class="image2" src="https://www.w3schools.com/w3css/img_mountains.jpg" />
<div class="">
<div class="left-img ib">
<img class="imageH" src="https://www.w3schools.com/w3css/img_lights.jpg" />
</div>
<div class="right-img ib">
<img class="imageH" src="https://www.w3schools.com/w3css/img_lights.jpg" />
</div>
</div>
</div>
可以根据需要修改类名和图像。
推荐阅读
- c# - 数据表。"select" 方法只返回一行
- node.js - Loopback:将修剪功能应用于所有传入的字符串属性
- python - python json object_pairs_hook dictionary decoded to None
- javascript - 在 Shadow DOM 中执行 JavaScript
- sql - 重置列自动增量
- javascript - 如何显示哪个用户登录到我的 HTML
- angular - Angular - 对父事件的子确认完成
- powerbi - Power BI - Rankx 和过滤器
- wordpress - How to hide breadcrumbs from all pages in WordPress
- javascript - Google 地方搜索框不仅在我的 html 页面中有效