I have a problem with divs in firefox and ie. the size the divs have to cover is 800px. The amout of divs that sits in this space is determined by the number of options which varies from 1 - 10 so first i work out the size of one div by menuIndSize = 800 / mmItems mmItems is the number of divs that is required.. so within a loop i have the code <div class="menuItem2" style="width:<%=cdbl(menuIndSize )%>px; background-color:<%=bgcolour%>;"><%=rsMainMenu("Section_Name")%> </div> Code (markup): In Firefox it always work perfectly in ie it doesnt.... in ie if for example the items is 4 or 5 it works as 800 / 4 = 200 and 200 is a whole number but if there are only 3 menu options for example 800 / 3 = 266.666666666667 and this isnt a whole number it doesnt work as i said this work perfectly in firefox but in ie its 2 pixels short.. what can i do??
menuIndSize = Round((800 / mmItems),0) While (menuIndSize*mmItems) >800 menuIndSize=menuIndSize-1 Wend
That'll make the total 798 (266 * 3), not 800. The solution is either to substract the lone pixel from the last div or add the 2 extra needed. I would do it by making the loop one iteration shorter than it needs to be, add the last div outside of the loop and make its width equal 800 - (menuIndSize*(mmItems-1)).
don't give width to the DIV give it to the table in which it is or use JavaScript that'll help you I guess