JSFiddle - React, Tailwind, and code Playground

HTML

<body>                  
<div id="div1">         
   <div id="child1">
       &nbsp;
   </div>
</div>
</body>

CSS

body {
   background: url("http://www.google.com/images/srpr/logo4w.png");
}
#div1 {
   background-color: #f3f3f3;
   margin: 20px;
   padding: 20px;
}
#child1 {
   background: url("http://www.google.com/images/srpr/logo4w.png");
}

JavaScript

$(function() {

  function positionBackground() {

     var myChild1   = $("#child1");
     myChild1.css({
        backgroundPosition : "-" + myChild1.offset().left + "px -" + myChild1.offset().top + "px"
     });
  }

  positionBackground();

  $(window).resize(positionBackground);
    
});