Good day.
I know that if you want to absolute center a div, you do this:
blahblah
As the width
and height
are fluid, you need to go with javascript or jQuery. Just add the below code in head
tag. (The below example is in javascript)
and your css would be something like this:
#parent{
max-width: 500px;
max-height: 500px;
background-color:green;
position:absolute;
top: 50%;
left: 50%;
/* width: 10%;
height: 10%; */
}
To test, give width: 10%; and height: 10%
Working Fiddle