按照指南here,我一直在努力使用CSS生成圈子。我已经完成了基础知识,但我试图将一个CSS生成的圆圈叠加在另一个上面。我的小提琴是here。
我想:
下面粘贴的是我想要显示圆圈的图片。
有人可以帮忙吗?
HTML:
<div id="law-outer-circle" class="circle"><div id="law-inner-circle" class="circle">Law firms</div></div>
<div id="industry-outer-circle" class="circle"><div id="industry-inner-circle" class="circle">Industry</div></div>
<div id="in-house-outer-circle" class="circle"><div id="in-house-inner-circle" class="circle">In-house counsel</div></div>
CSS:
.circle {
border-radius: 50%;
display: inline-block;
margin-right: 20px;
/* text styling */
font-size: 45px;
color: #FFF;
line-height: 75px;
text-align: center;
font-family: Arial;
}
#industry-inner-circle {
width: 250px;
height: 250px;
background: #DD4814;
position: absolute;
top: 24%;
left : 24%;
display: block;
border: 2px solid #fff;
}
#industry-outer-circle {
background: #DD4814;
width: 270px;
height: 270px;
position:relative;
}
#in-house-inner-circle {
width: 250px;
height: 250px;
background: #AEA79F;
position: absolute;
top: 24%;
left : 24%;
display: block;
border: 2px solid #fff;
}
#in-house-outer-circle {
background: #AEA79F;
width: 270px;
height: 270px;
position:relative;
}
#law-inner-circle {
width: 250px;
height: 250px;
background: #5E2750;
position: absolute;
top: 24%;
left : 24%;
display: block;
border: 2px solid #fff;
}
#law-outer-circle {
background: #5E2750;
width: 270px;
height: 270px;
position:relative;
}
答案 0 :(得分:2)
您可以使用css box-shadow
属性以这种方式执行此操作。
<强> HTML 强>
<div class="circle color-1 color1-box-shadow">
industry
</div>
<div class="circle text color-2 color2-box-shadow">
In-house legal counsel
</div>
<div class="circle color-3 color3-box-shadow">
Law Firms
</div>
<强>的CSS 强>
.circle {
border-radius: 50%;
float: left;
display: inline-block;
margin-right: 20px;
/* text styling */
font-size: 45px;
width: 250px;
height: 250px;
color: #FFF; border: 2px solid #fff;
line-height: 250px;
text-align: center;
font-family: Arial;
}
.color-1 { background: #DD4814;}
.color-2 { background: #AEA79F; }
.color-3 { background: #5E2750; }
.color1-box-shadow { box-shadow: 0px 0px 1px 1px #DD4814 }
.color2-box-shadow { box-shadow: 0px 0px 1px 1px #AEA79F }
.color3-box-shadow { box-shadow: 0px 0px 1px 1px #5E2750 }
.text { line-height: 45px; padding-top: 50px; height: 200px }
答案 1 :(得分:1)
提供.circle { line-height: 250px; }
(与您的内圈高度相同)并将内圈top
和left
值更改为8px
(outerCircleHeight - innerCircleHeight - bothSidesBorder / 2 = 8)。
#industry-inner-circle {
top: 8px;
left : 8px;
}