我目前正在學(xué)習(xí)CSS,并試圖在一個(gè)圓內(nèi)放置多個(gè)旋轉(zhuǎn)的線段。雖然我能夠做到這一點(diǎn),但我無(wú)法弄清楚在這種情況下絕對(duì)和相對(duì)定位的用法。我瀏覽了多個(gè)文檔和答案,但無(wú)法找到我的問(wèn)題的具體答案。
.circle {
position: relative;
width: 100px;
height: 100px;
border-radius: 50%;
border: 2px solid blue;
margin-left: 250px;
}
.line1 {
position: absolute;
border-left: 4px solid blue;
height: 100px;
margin-left: 50%;
}
.line2 {
border-left: 4px solid blue;
position: absolute;
height: 100px;
transform: rotate(15deg);
margin-left: 50%;
}
<div class="circle">
<div class="line1"></div>
<div class="line2"></div>
</div>