-1
.container-form {
width: 300px;
height: 300px;
background-color: rgb(22, 20, 20);
position: relative;
}
.filha {
width: 100px;
height: 100px;
background-color: azure;
position: absolute;
top: 50%;
left: 50%;
}
*{
margin: 0px;
padding: 0px;
}
<div class="container-form">
<div class="filha">
</div>
</div>
I have tried everything and I cannot center any div inside another or any element in relation to the body... It’s like I put 50% in one direction, but in practice it’s like 70%... Someone can help me solve this problem?
can explain how the
transform: translate(-50%,-50%)
centralizes the div? this will improve the answer and the understanding of who reads the question, is better than "use it there" :)– Ricardo Pontual
our downvote in a correct answer, this stack is getting worse and worse. These point hunters are out of control
– Alexis Garcia
I can not speak for others but, I did not give negative but I believe it is because of the answer "no explanation" as I had commented, because it was edited a short time ago, or maybe pq already has an answer with the same solution
– Ricardo Pontual