How can I change the width in a child to put it inside the parent div?
It should be internal to padding. In this case, top and left are fine but right is not proper.
https://jsbin.com/tuhohuvoxa/edit?html,css,output
.parent {
  padding: 20px;
  border: 0.1em solid;
  height: 200px;
}
.child {
  position: absolute;
  border: 0.1em solid;
  height: 10px;
  width: 100%;
}