I have a div that has not a preset width in css, I'm trying to center in on screen with JQuery, it works in Chrome, Firefox and IE8+, but does not work in IE7. Why?
css:
.productBoxWrapper{
height:210px;
clear:both;
background-color:blue;
}
JQuery:
$('#mydiv').css("position", "absolute");
this.css("left", ($(window).width() - $("#mydiv").width()) / 2 + "px");
JSFiddle: http://jsfiddle.net/tygcz/3/