我有一個帶有非均勻邊(64像素x 42像素)的PNG圖像圖標,我想在它周圍創建一個圓形邊框。png帶有圓形邊框的圖標 - CSS
我的HTML看起來像這樣:
<span class="cat_circle">
<div class="cat_icon">
<img src="https://cdn.pbrd.co/images/GNK97WG.png">
</div>
</span>
我創建的圖像繞了一圈邊框,但我不能得到的圖標圓的正中間。該圖標位於圓圈的右下角。
這裏是我的圓邊框CSS:
.cat_circle {
border: 3px solid #7E9CC2;
border-radius: 50%;
width: 25px;
height: 25px;
overflow: hidden;
position: absolute;
padding: 30px;
left: 10px;
top: 10px;
text-align: center;
vertical-align: middle;
}
我便開始與實際PNG圖像擺弄,我給它這樣的切緣陰性:
.cat_icon {
margin-top: -10px;
margin-left: -18px;
}
我的意思是,似乎工作,我有我的圖標在圈子中間,但這是我應該接近這個正確的方式?
這裏是我的小提琴:https://jsfiddle.net/ox0anvL7/
您的HTML無效。跨度不能包含div元素。 – Rob