title: Dynamically create divs with height and width
body: <p>I'm dynamically creating divs in my application, and wants through parameters in a function to choose the width and height of the divs. The code below works, however I don't want to add styling directly to my HTML document which it does.</p>
  
  <p>Is there another way to accomplish this without adding css to the HTML document?</p>
  
  <pre><code>function createDiv(theWidth, theHeight){
  
  var box = $('&lt;div/&gt;', {
     'class': 'box',
     'width': theWidth,
     'height': theHeight,
  }).appendTo('#content');
  
  }
  </code></pre>
  
  <p>Note: The height and width is retrieved from a JSON-file through AJAX and can differ. By that reason I can't create different classes with different heights and widths.</p>