title: Css is set in jquery
body: <p>I have the following code:</p>
  
  <pre><code>function MyFitText2(width, height, span) {
      var fontSize = 20;
      $(span).css('font-size', fontSize);
      do {
          fontSize = fontSize - 1;
          textHeight = $(span).height();
          textWidth = $(span).width();
          $(span).css('font-size', fontSize);
      } while ((textHeight &gt; height || textWidth &gt; width) &amp;&amp; fontSize &gt; 1);
  }
  </code></pre>
  
  <p>and use:</p>
  
  <pre><code>var pinkboxspan = "&lt;span style=\"position:absolute; left:" + $thisPinkBox["PinkBoxLeft"] + "px; top:" + $thisPinkBox["PinkBoxBoxTop"] + "px; " +
                          "text-align:left; font-weight: bold; color: red; background: linear-gradient(rgba(255, 215, 15, 0.5),rgba(255, 215, 15, 0.5));" +
                          "line-height:1.1; " +
                          "\"&gt;" + text + "&lt;/span&gt;&amp;nbsp;";
  
  MyFitText2($thisPinkBox["PinkBoxWidth"], $thisPinkBox["PinkBoxHeight"], pinkboxspan);
  $(pinkboxspan).css('width', $thisPinkBox["PinkBoxWidth"] + 'px');
  $(pinkboxspan).css('height', $thisPinkBox["PinkBoxHeight"] + 'px');
  </code></pre>
  
  <p>but in result:</p>
  
  <pre><code>&lt;span style="position:absolute; left:870px; top:413px; text-align:left; font-weight: bold; color: red; background: linear-gradient(rgba(255, 215, 15, 0.5),rgba(255, 215, 15, 0.5));line-height:1.1; "&gt;Sergey's Office
  &lt;br&gt;Y Amphitheatre Parkway
  &lt;br&gt;Mountain View, CA XXXXX
  &lt;br&gt;United States
  &lt;br&gt;&lt;/span&gt;
  </code></pre>
  
  <p>then I add it to DOM by the following way:</p>
  
  <pre><code>var imageElement = $("&lt;div style='text-align:left;'&gt;&lt;div style='position: relative; display: inline-block;'&gt;&lt;img style='position: relative; vertical-align: central;' src='" + $('#previewImage').attr('src') + "' /&gt;&lt;/div&gt;&lt;/div&gt;");
  
  var divElement = imageElement.find('div');
  
  var divContent = '';
       // code above in $.each
       divContent = divContent + pinkboxspan;
  
  divElement.append(divContent);
  
  $('#divOverlay').html(divElement);
  </code></pre>
  
  <p>so, parameters width/height are not set. Why and how to solve it?</p>