green box

position: relative; width: 40px; height: 40px; padding: 5px; border: 5px solid blue;

black box

position: as specified individually; width: 50%; height: 100%; right: 0; bottom: 0; padding: 0; border: none;

box-sizing position should be actual rendering
content-box static
relative
absolute
border-box static
relative
absolute