我正在尝试绘制一些CSS生成的圆形,这些圆形具有图像作为背景。在我的当前代码中,背景图像被设置为CSS代码中的固定图像。
.container {
text-align: center;
}
.circle {
position: relative;
height: 180px;
width: 180px;
border-radius: 50%;
display: inline-flex;
vertical-align: top;
justify-content: center;
align-items: center;
overflow: hidden;
text-decoration: none;
border: 0;
margin: 10px;
}
.circle:after {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: url("http://deepchains.com/images/team.png") center / cover no-repeat;
opacity: .25;
transition: .25s;
}
.circle:hover:after {
opacity: 1;
color: transparent;
}
.circle:hover {
color: transparent;
}
.ccont {
display: inline-block;
margin: 10px;
}
.ccont:hover {
color: transparent;
}
<div class="container">
<a class="circle" href="http://www.url1.html">
<div class="ccont" style="font-weight: bold; text-decoration:none !important;">This is <br>Text1</div>
</a>
<a class="circle" href="http://www.url2.html">
<div class="ccont" style="font-weight: bold; text-decoration:none !important;">This is <br>Text2</div>
</a>
</div>
这是我在Chrome浏览器中看到的示例结果:
我的问题是如何在HTML代码中分别更改每个圆的背景图像?我会有很多这些圆,我希望它们排列整齐并在同一行中,并且我想在HTML代码中设置它们的背景图像并从CSS中删除背景图像。我该怎么做?
style
属性中。 - lolbas