如何使用 CSS 和图像创建一个带有切口的圆圈?我想要的示例如下所示.需要一个跨浏览器解决方案,并且使用 css 而不是 html.
How do I create a circle with a cut through it using CSS and an image in it? An example of what I want is shown below.Need a crossbrowser solution and with css not html.
您可以通过使用伪元素创建圆然后使用 overflow: hidden 倾斜容器来做到这一点.
You can do this by creating the circle using a pseudo-element and then skewing the container with overflow: hidden.
子伪元素被反向倾斜,使其看起来好像根本没有倾斜.
The child pseudo-element is reverse skewed to make it appear as though it is not skewed at all.
.shape {
position: relative;
height: 100px;
width: 120px;
overflow: hidden;
-webkit-transform: skew(-45deg);
-moz-transform: skew(-45deg);
transform: skew(-45deg);
}
.shape:after {
position: absolute;
content: '';
top: 0px;
left: 0px;
height: 100px;
width: 100px;
background: black;
border-radius: 50%;
-webkit-transform: skew(45deg);
-moz-transform: skew(45deg);
transform: skew(45deg);
}
<div class="shape"></div>
这篇关于如何用 CSS 绘制一个不完整的圆圈以及如何在其中放置图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
ionic - 如何在 ion-header 中对长字符串进行自动换行ionic - How to wordwrap a long string in ion-header(ionic - 如何在 ion-header 中对长字符串进行自动换行)
如何在角度2中动态更改css类名How to change the css class name dynamically in angular 2(如何在角度2中动态更改css类名)
使用模态和样式的 Ionic 2 登录弹出窗口Ionic 2 login popup using Modal and styling(使用模态和样式的 Ionic 2 登录弹出窗口)
如何在ionic 3中进行水平滚动how to do horizontal scroll in ionic 3(如何在ionic 3中进行水平滚动)
与另一个离子卡重叠的虚拟滚动 ion-img 标签Virtual scroll ion-img tag overlapping to another ion card(与另一个离子卡重叠的虚拟滚动 ion-img 标签)
如何删除输入类型中的默认颜色?How to remove default color in input type?(如何删除输入类型中的默认颜色?)