Since 3 hours I'm trying to find how to inverse border radius, I saw a small code in css3 specially for that, but I can't find it ...
You must know I'm working with wordpress (unfortunately)
Have an idea ?
The trick to making the inverted border radius (at least using this method) is to create a pseudo element, and then cut a normal border radius out of that element. Let's set up the pseudo element, and let's at the same time already add the border radius to it to speed life up a little bit!
It is possible to give margins a negative value. This allows you to draw the element closer to its top or left neighbour, or draw its right and bottom neighbour closer to it.
To create a rounded corner, we use the CSS border-radius property. This property is used to set the border-radius of element.
If your tab has a solid background color you can use pseudo elements to archive this.
First we create a tab with border radius in the top left and top right corners.
.tab {
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
Then we add position: relative
, because we need to use position: absolute in the pseudo elements.
.tab {
position: relative;
}
Now, we are going to create and position our pseudo elements as a quarter of a circle, transparent, with box-shadow to simulate borders.
.tab:before,
.tab:after {
content: "";
position: absolute;
height: 10px;
width: 20px;
bottom: 0;
}
.tab:after {
right: -20px;
border-radius: 0 0 0 10px;
-moz-border-radius: 0 0 0 10px;
-webkit-border-radius: 0 0 0 10px;
-webkit-box-shadow: -10px 0 0 0 #fff;
box-shadow: -10px 0 0 0 #fff;
}
.tab:before {
left: -20px;
border-radius: 0 0 10px 0;
-moz-border-radius: 0 0 10px 0;
-webkit-border-radius: 0 0 10px 0;
-webkit-box-shadow: 10px 0 0 0 #fff;
box-shadow: 10px 0 0 0 #fff;
}
And this is the result:
DEMO: jsFiddle
body {
background: #1c1c1c;
padding: 50px;
}
.tab {
float: left;
width: 90px;
padding: 10px 15px;
height: 30px;
position: relative;
background: #fff;
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.tab:before,
.tab:after {
content: "";
position: absolute;
height: 10px;
width: 20px;
bottom: 0;
}
.tab:after {
right: -20px;
border-radius: 0 0 0 10px;
-moz-border-radius: 0 0 0 10px;
-webkit-border-radius: 0 0 0 10px;
-webkit-box-shadow: -10px 0 0 0 #fff;
box-shadow: -10px 0 0 0 #fff;
}
.tab:before {
left: -20px;
border-radius: 0 0 10px 0;
-moz-border-radius: 0 0 10px 0;
-webkit-border-radius: 0 0 10px 0;
-webkit-box-shadow: 10px 0 0 0 #fff;
box-shadow: 10px 0 0 0 #fff;
}
<div class="tab"></div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With