title: How to set element's width equal to half of the window's width
body: <p>I am trying to automatically generate rounded values with the floor function but it stays static. Can you please help me how to improve my code ? Thank you very much.</p>
  
  <p>jQuery:</p>
  
  <pre><code>$(document).ready(function() {
  
      width_split = $(document).width();
      width_split = Math.floor(width_split / 2);
  
      $(document).resize(function() {
          width_split = $(document).width();
          width_split = Math.floor(width_split / 2);  
      });
  
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;p style="position:absolute; right:"+width_split+"px;"&gt;
     .content
  &lt;/p&gt;
  </code></pre>