I have clip-part
to make "cut corner" effect.
I would like to change background to white and use green border. Problem is, when I change ba
As far as I know, it's not really possible to make a border around an element with a clip-path. This method uses inside and outside elements. Source: https://codepen.io/bennettfeely/pen/azJWWX/
.outside {
position: relative;
width: 70vmin;
height: 70vmin;
background: red;
-webkit-clip-path: polygon(50% 0%, 83% 12%, 100% 43%, 94% 78%, 68% 100%, 32% 100%, 6% 78%, 0% 43%, 17% 12%);
clip-path: polygon(50% 0%, 83% 12%, 100% 43%, 94% 78%, 68% 100%, 32% 100%, 6% 78%, 0% 43%, 17% 12%);
}
.inside {
position: absolute;
top: 5px;
left: 5px;
right: 5px;
bottom: 5px;
background: red;
-webkit-clip-path: polygon(50% 0%, 83% 12%, 100% 43%, 94% 78%, 68% 100%, 32% 100%, 6% 78%, 0% 43%, 17% 12%);
clip-path: polygon(50% 0%, 83% 12%, 100% 43%, 94% 78%, 68% 100%, 32% 100%, 6% 78%, 0% 43%, 17% 12%);
}
.inside:hover {
background: white;
transition: all .2s;
}
.outside:hover {
background: green;
transition: all .2s;
}
/* Center the demo */
html, body { height: 100%; }
body {
display: flex;
justify-content: center;
align-items: center;
background: papayawhip;
}