Reputation:
Hi I'm writing a Web calculator and the main div's width in ie needs to be 2 more px than in ff and ch, which makes it look a little loose in ff and ch or completely broken in ie. here's a link to the calc and a jsFiddle. If someone can help me reduce those two px's (#main{width: 186px;} is what I wan't to get) or at least make the buttons spread evenly in all browsers, it'd be helpful. Thanks in advance.
Upvotes: 0
Views: 97
Reputation: 449
add following script
var mainDiv = document.getElementById('main');
var divWidth = parseInt(mainDiv.style.width);
if(navigator.appName=="Microsoft Internet Explorer")
{
mainDiv.style.width = divWidth + 2 + 'px';
}
Upvotes: 0
Reputation: 4131
Use an IE hack ?
Something like
<!--[if lte IE 8]>
<style type="text/css">
#main {
width: 188px !important;
}
</style>
<![endif]-->
in your head markup for IE up to version 8 here (changeable) and put your css back to 186px in your css file.
That's a bit cheating, but if that's alright with you...
Upvotes: 1