Q:

Enforce absolute child element to fit parent with padding

How can I force a child with absolute positioning to fit parent with padding? Absolute positioning on child is a must in my case.
EDIT: I want child to get inside parent's content box, not just fit into the box.
<body>
 <div id="wrapper">
  <div id="elem">

  </div>
 </div>
</body>

<style>
#wrapper{
  padding:25px;
  height:100%;
  width:100%;
   background-color:blue;
   position:relative;
}

#elem{
  width:100%;
  height:100%;
  position:absolute;
  background-color:green;
}
</style>

Link to jsfiddle: https://jsfiddle.net/wmbszuzo/

A:

You could do this using box-sizing: border-box; and width: calc(100% - 50px);
https://jsfiddle.net/wmbszuzo/10/

