The following CSS code will align the absolute positioned div inside a container.

Note: This will only work depending on the max-width of the container. Need to adjust for mobile devices.

<!Doctype html>
<html>
<head>
  <style>
    .page-body {
       max-width: 800px;
       background: #ccc;
       position: relative;
       display: flex;
       flex-direction: column;
       align-items: center;
       padding: 100px;
     }
    .page-container {
       max-width: 500px;
       background: #eee;
       display: block;
       padding: 20px;
    }
    .abs-position {
       position: absolute;
       top: 50px;
       right: calc((100% - 500px)/2 + 0px);
       padding: 20px;
       text-align: center;
       border: 1px solid #ccc;
       border-radius: 10px;
       background: #a5f6c0;
       width: 200px;
    }
  </style>
</head>
<body>
  <div class="page-body">
    <div class="page-container">
      <h1>Page title</h1>
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
    </div>
    <div class="abs-position">I am positioned absolute!</div>
  </div>
</body>
</html>

Page title

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

I am positioned absolute!