Open GH1995 opened 4 years ago
<figure class="tree">
<div class="branch">
<span class="leaf"></span>
<span class="leaf"></span>
<span class="leaf"></span>
</div>
<div class="branch">
<span class="leaf"></span>
<span class="leaf"></span>
</div>
</figure>
.tree {
display: flex;
flex-direction: column;
justify-content: space-around;
width: 30px;
height: 300px;
border-radius: 5px;
background-color: saddlebrown;
}
.tree .branch {
display: flex;
justify-content: flex-end;
width: 160px;
height: 20px;
border-radius: 10px;
transform: rotate(-30deg);
background-color: peru;
}
.tree .branch .leaf {
width: 40px;
height: 40px;
border-radius: 100% 0 100% 0;
transform: translateY(-100%);
background-color: green;
}
<figure class="triangle">
<div><span></span></div>
<div><span></span><span></span></div>
<div>
<span></span>
<span></span>
<span></span>
</div>
<div>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</figure>
.triangle {
display: flex;
flex-direction: column;
align-items: center;
width: 500px;
div {
display: flex;
justify-content: space-between;
height: 50px;
margin: 5px;
span {
width: 50px;
height: 50px;
margin: 10px;
border-radius: 50%;
background-color: lightgreen;
&:first-child, &:last-child {
background-color: lightcoral;
}
}
}
}
用标签选择器绘制图1-2所示的3个圆