css – Place a div in percent in relation to overall div

When setting the position, the corner of the object used is not the center. You will notice that it successfully places the top right corner of your box 50% from the top and 50% from the left.

You can try to set the top / bottom and left / right positions of the object to be the same, such as:

right: 33%;
left: 33%;
top: 25%;
bottom: 25%;

You may need to play with these values ​​depending on the size of your object

Leave a Comment