【发布时间】:2015-11-29 21:44:42
【问题描述】:
现在我看到许多主题使用放置在 div 上的三角形/箭头蒙版
你可以在视频中看到here
但如果可能的话,我想做一个倒置(负)边界半径,形成一个 半圆,有点像这样
我几乎可以使用径向渐变,但它在 Chrome 中看起来很前卫。
http://jsfiddle.net/EjE7c/2457/
.haflcircle {
background:
-moz-radial-gradient(100% 0, circle, rgba(0,0,0,0) 25px, #000 25px),
-moz-radial-gradient(0 0, circle, rgba(0,0,0,0) 25px, #000 25px);
background:
-o-radial-gradient(100% 0, circle, rgba(0,0,0,0) 25px, #000 25px),
-o-radial-gradient(0 0, circle, rgba(0,0,0,0) 25px, #000 25px);
background:
-webkit-radial-gradient(100% 0, circle, rgba(0,0,0,0) 25px, #000 25px),
-webkit-radial-gradient(0 0, circle, rgba(0,0,0,0) 25px, #000 25px);
}
.haflcircle {
background-position: bottom left, bottom right, top right, top left;
-moz-background-size: 50% 50%;
-webkit-background-size: 50% 50%;
background-size: 50% 50%;
background-repeat: no-repeat;
height:50px;
width:100%;
position:absolute;
bottom:0;
left:0;
}
如果您知道更好的方法来做到这一点,那就太好了。
在here 的帮助下找到合适的解决方案 它也适用于透明颜色 http://jsfiddle.net/EjE7c/2465/ thnx 为您提供帮助
【问题讨论】:
-
我会使用伪元素。
-
@Vucko 如果你能举个例子就太好了。
-
我只做了一些小改动。对于
-moz-radial-gradient,最后一个值增加到26px和height:52px;,如果您可以接受的话。有一个例子:jsfiddle.net/EjE7c/2461 -
感谢它,但它看起来很糟糕,看到这个,prntscr.com/8cb80j chrome
-
@Benn:此线程 (stackoverflow.com/questions/8503636/…) 中讨论了很多方法,您可能想看看。
标签: css css-shapes