<style>
.parent {
position: relative;
background-color: black;
width: 100px;
height: 100px;
}
.child {
position: relative;
background-color: rgba(0,255,0,0.8);
width: 100px;
height: 100px;
}
</style>
<div class=parent>
<div class=child>
</div>
</div>
<div class=parent>
<div>
<div class=child>
</div>
</div>
</div>
<script>
document.body.offsetTop;
var children = document.getElementsByClassName("child");
children[0].style.backgroundColor = "rgba(0,255,0,0.5)";
children[1].style.backgroundColor = "rgba(0,255,0,0.5)";
</script>