title: how to center a div created dynamically with position absolute
body: <pre><code>str.Append("&lt;div class=\"rect\" style=\"top:" + (rectangles.ElementAt(i).Y + 50).ToString() + "px;left:" + (rectangles.ElementAt(i).X + 50).ToString() + "px;width:" + (rectangles.ElementAt(i).Width - 1).ToString() + "px;height:" + (rectangles.ElementAt(i).Height - 1).ToString() + "px;position:absolute;\"&lt;/div&gt;");
  </code></pre>
  
  <p>I am creating this div and more divs that has been positioned absolute and then send the created html to another div(container). So that it creates a map the image is attached</p>
  
  <p><a href="https://i.stack.imgur.com/HKXtT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HKXtT.png" alt="enter image description here"></a></p>