1
I have this div
with edges in the corners and wanted the right edge to be down and the left edge to be up when the div is on hover
but I couldn’t apply the effect.
Below is what I tried:
div.classe {
position: relative;
float: left;
padding: 0 10px;
width: 80%;
height: 100px;
background: rgba(38, 166, 91, 0.5);
margin-top: 30px;
transition: all 0.4s ease-in-out;
}
div.classe:after {
content:"";
height: 70px;
width: 70px;
position: absolute;
bottom: 0;
left: 0;
border-left: 4px solid #000;
border-bottom: 4px solid #000;
z-index:-1;
margin-bottom:-4px;
margin-left: -4px;
border-color
}
div.classe:before {
content:"";
height: 70px;
width: 70px;
position: absolute;
top: 0;
right: 0;
border-right: 4px solid #000;
border-top: 4px solid #000;
z-index:-1;
margin-top:-4px;
margin-right: -4px;
}
div.classe:hover{
transform: translateY(-20px);
}
div.classe:hover:before{
content:"";
height: 70px;
width: 70px;
position: absolute;
right: 0;
top: 0;
border-right: 4px solid #000;
border-top: 4px solid #000;
z-index:-1;
margin-top:-4px;
margin-right: -4px;
border-color
}
div.classe:hover:after{
content:"";
height: 70px;
width: 70px;
position: absolute;
bottom: 0;
left: 0;
border-left: 4px solid #000;
border-bottom: 4px solid #000;
z-index:-1;
margin-bottom:-4px;
margin-left: -4px;
}
<div class="classe">
texto qualquer
</div>
This already solved my problem a lot, only one question had how to make a smoother transition? type of sliding around the edges?
– Everton Figueiredo
I edited the question see now.
– Caique Romero