【发布时间】:2015-01-02 17:33:34
【问题描述】:
我正在尝试在 CSS 中创建此设计。有可能吗?
这是我的代码:
.triangle{
border-radius: 50%;
width: 120px;
height: 120px;
}
.triangle img {
width: 120px;
height: 120px;
}
.triangle::after{
right: 150px;
top: 50%;
border: solid transparent;
content:"";
height: 0px;
width: 0px;
position: absolute;
pointer-events: none;
border-color: white;
border-left-color: white;/*white is the color of the body*/
border-width: 60px;
margin-top: -60px
}
<div class="triangle">
<img src="http://deskode.com/images/placeholder/team/07.jpg">
</div>
三角形已形成,但与图像的方式不同。
【问题讨论】:
-
我现在无法测试,但
.triangle上的overflow: hidden应该会有所帮助。 -
我会看看CSS Clipping Masks。
标签: html css css-shapes