* {margin: 0;}
div {
background-color:#bad455;
width: 200px;
height: 200px;
top:50%;
left:50%;
position:fixed;
transform: translate(-50%, -50%);
text-align:center;
}
div:hover {
box-shadow: 3px 5px 50px 5px;
display:inline-block;
border-radius:10%;
transform:skewX(50deg);
}
div p {
top:50%;
position:relative;
}
<div>
<p>oooo</p>
</div>
When I did top:50%
and set the position:relative
, I was expecting this text to go in the middle. But now I can see it isn't exactly in the middle of it. If someone could explain I would be grateful!