window.onload=function(){ var d=document.createElement('div'); d.style.width='200px'; d.style.height='100px'; d.style.background='gray'; document.body.appendChild(d); }
<style> .div_one { position:relative; float:left; left:5px; background-color:red; width:30px; height:30px; } </style> <script> window.onload=function() { var d = document.createElement('div'); d.className='div_one'; document.body.appendChild(d); } </script>
<style type="text/css"> .div_one{ position:relative; float:left; left:5px; background-color:red; width:300px; height:300px; } </style> <script type="text/javascript"> var d = document.createElement('div'); d.className='div_one'; document.body.appendChild(d); </script>