console
var div = document.querySelector('div');
console.log(div);
var span = document.querySelector('span');
console.log(span);
function father_son_center(selector) {
selector.style.transform = 'translate(-50%, -50%)';
selector.style.left = '50%';
selector.style.top = '50%';
}
father_son_center(span);
<div><span></span></div>
div {
float: left;
width: 499.9999px;
height: 400px;
background: rgb(218, 90, 112);
position: relative;
}
span {
width: 50px;
height: 50px;
background: rgb(97, 38, 47);
position: absolute;
}