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
i'll make an answer of my comment for readability :
For infos , if
clip-path
is used on a 2 level container, it is possible to add a shadow around the translucide edges withdrop-shadow()
filter .
clip-path
applied on the childdrop-shadow()
on the parent- without a blur , it looks like a border no matter the shape : https://jsfiddle.net/q9tdpvfg/
jsfiddle demo in the snippet below:
.test div {
background: red;
width: 100px;
height: 100px;
/* CORNERS */
clip-path: polygon(10px 0%, calc(100% - 10px) 0%, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0% calc(100% - 10px), 0% 10px);
}
.test:hover {
filter: drop-shadow(0px 3px 0px green) drop-shadow(3px 0px 0px green) drop-shadow(-3px 0px 0px green) drop-shadow(0px -3px 0px green);
/* made 1 for each sides */
}
.test:hover div {
background: white;
cursor: pointer;
}
.test {
width: max-content;
}
.test div {
/* demo purpose */
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
TEST