[英]How to make Inverted curve or border-radius for div
I have been working on one project in which i have to style a border of a div inverted to achieve this i can only use css and js i cannot use any plugins. 我一直在进行一个项目,在这个项目中我必须设置div倒置边框的样式以实现此目的,我只能使用CSS和JS,而不能使用任何插件。 I have gone through several online posts and similar looking questions on stack but couldnt really find what i want , I am attaching a 我遍历了几篇在线帖子和类似的外观问题,但是找不到真正想要的东西,我附上了 for reference as well as a fiddle of what i have tried so far. 供参考,以及一个小提琴什么,我至今尝试过。
.outer { overflow: hidden; } .inner { border: 1px solid #888; } .inner i { width: 40px; height: 40px; border: 1px solid #888; border-radius: 50%; background-color: #fff; } .inner .top { margin-top: -20px; } .inner .bottom { margin-top: -20px; margin-bottom: -22px; } .inner .left { float: left; margin-left: -20px; } .inner .right { float: right; margin-right: -20px; } .content { min-height: 80px; }
<div class="outer"> <div class="inner"> <i class="top left"></i> <i class="top right"></i> <div class="content"></div> <i class="bottom right"></i> <i class="bottom left"></i> </div> </div>
Am sure This will help you 肯定会帮到你
Demo: http://jsfiddle.net/mxehp3sh/2/ 演示: http : //jsfiddle.net/mxehp3sh/2/
HTML 的HTML
<div id="a" class="circle-border">B</div>
CSS 的CSS
body{background:yellow;}
.circle-border {margin:10px;
display: inline-block;
position: relative;
height: 100px;
text-align: center;
line-height: 100px;
vertical-align: middle;
}
#a {
width: 90%;
border-left: none;
-webkit-border-top-right-radius: 20px;
-webkit-border-bottom-right-radius: 20px;
-moz-border-radius-topright: 20px;
-moz-border-radius-bottomright: 20px;
background-image: -moz-radial-gradient(
100% 50%,
circle closest-corner,
transparent 0,
transparent 55px,
transparent 56px,
grey 57px
);
background-image: -webkit-radial-gradient(100% 50%, circle closest-corner, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 55px, transparent 56px, grey 57px);
background-image: -ms-radial-gradient(100% 50%, circle closest-corner, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 55px, transparent 56px, grey 57px);
background-image: -o-radial-gradient(100% 50%, circle closest-corner, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 55px, transparent 56px, grey 57px);
background-image: radial-gradient(100% 50%, circle closest-corner, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 55px, transparent 56px, grey 57px);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.