views:

42

answers:

1

I am using jquery to determine the width of the control:-

$("#div1").width();

There is a difference in width of the div between IE8 (in compatibility view) and Firefox. Width is not same.

e.g ie : 1887 FF : 1898

How to tackle it?

+1  A: 

I guess the difference between the browsers' display exists because of their different perceptions of the CSS box model. The IE does interprete it another way than Firefox does (e.g. the padding property is treated differently).

Marius Schulz
@Marius: Thanks that makes sense. Can you just tell me how padding is treated differently....?
Novice
This might help explain the difference in the box model between IE and other browsershttp://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-did-internet-explorer-get-the-box-model-right/
Catfish
Short version: Early versions of the IE took account of the padding in the `width` property whereas Firefox did / does not. For further information, see the video Catfish posted.
Marius Schulz
Thanks both. It helped actually.
Novice