這個圈子周圍不得有可點擊的區域,我該怎麼做?如何在物體周圍創建不可點擊的區域?
.circ {
position: absolute;
left: 50%;
top: 50%;
width: 400px;
height: 400px;
border-radius: 50%;
background: red;
overflow: hidden;
transform: translate(-50%, -50%);
}
.circ .sub-1,
.circ .sub-2 {
position: absolute;
width: 200px;
height: 200px;
background: green;
}
.circ .sub-1 a,
.circ .sub-2 a {
position: relative;
display: block;
width: 100%;
overflow: hidden;
height: 100%;
background: yellow;
}
.sub-2 {
bottom: 0;
right: 0;
}
<div class="circ">
<div class="sub-1">
<a href="#"></a>
</div>
<div class="sub-2">
<a href="#"></a>
</div>
</div>
非常感謝人! –
其實,你的代碼在Edge/Firefox中工作,但不是Chrome,它具有剪裁和邊框半徑的歷史記錄:http://stackoverflow.com/questions/29101743/inconsistent-selectable-area-of-elements-with-border -radius – LGSon
檢查舊的答案,並找到它。我更新了我的答案,其中也包含了一個可以在Chrome上運行的示例,所以如果您可以查看它,並且它能夠正常運行/接受它。 – LGSon