IE8 Bug: Setting width or height property of IE8 DOM rounds down fractional part, and looses consistency with style attribute.

by akatsuki

HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.js"></script>
<p id="box1"></p>
<p id="box2"></p>

JavaScript

jQuery.each({ box1: '500.4px', box2: '500.5px' }, function(id, value){
    var box = $('#' + id);
    
    // raw css
    box.attr('style', 'width:' + value);
    box.append(box.css('width')).append(' (' + box[0].style.width + ')');
    
    box.append('<br />');
    
    // dom property 
    box[0].style.width = value;
    box.append(box.css('width')).append(' (' + box[0].style.width + ')');
});