简体   繁体   English

CSS边框的轮廓

[英]outline of border in css

I'm new with css, but the thing that i'm trying to do is slightly complicated, at least for me. 我是CSS的新手,但是我想做的事情有点复杂,至少对我而言。 I have a picture that i want to cover with a circle, transparent from the inside, black from the outside. 我有一幅想要用圆圈覆盖的图片,里面是透明的,外面是黑色的。 this is what I've accomplished so far: 到目前为止,这是我已经完成的工作:

 .roundedBorder { border: 1px solid #1EC865; border-width: 4px; border-radius: 81px; } .img { position:absolute; top:6px; left:6px; width:81px; } 
 <img class=img src="http://suptg.thisisnotatrueending.com/archive/13559636/images/1295334728830.jpg"> <div style="position:absolute;width:70px;height:70px;border-width: 4px;position:absolute;" class="roundedBorder"> </div> 

https://jsfiddle.net/dmL56kek/ https://jsfiddle.net/dmL56kek/

now i'm looking to cover the outer of circle with a solid color. 现在,我希望用纯色覆盖圆形的外部。

PS: i don't want to apply any style on the image because it won't work in my case. PS:我不想在图像上应用任何样式,因为它在我的情况下不起作用。

A little change is css would help and i have used width:78px with a calculation that width of outer div is 70px and border is 4px from left and right. 一个小小的变化是css会有所帮助,我使用width:78px进行计算,即外部div的宽度为70px,边框从左和右为4px。

 .roundedBorder { border: 1px solid #1EC865; border-width: 4px; border-radius: 81px; } .img { position:absolute; top:8px; left:8px; width:78px; border-radius:100%;} 
 <img class=img src="http://suptg.thisisnotatrueending.com/archive/13559636/images/1295334728830.jpg"> <div style="position:absolute;width:70px;height:70px;border-width: 4px;position:absolute;" class="roundedBorder"> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM