Lets say i have the following HTML:
<div class="parent">
<div class="square-child"></div>
</div>
What i'm trying to accomplish is having the square-child
fill out as much of its parent, without losing propertions, and staying centered at all time. I have made a sketch with the square-child
being showed in red and parent
being showed in green.
I was reading the following SO-question, but couldn't get it centered: Maintain the aspect ratio of a div with CSS
EDIT: Added fiddle https://jsfiddle.net/2bg1jzg3/2