18-10-2006, 06:36 PM
IE works slightly diffently with padding and margins compared to other browsers, this is the one case where you should always keep IE in mind before other browsers, as this is often the key reason why things go wrong in IE.
IE, instead of measing just the width of the content, takes the width property as the sum of the width of the content, padding and borders. This actually makes alot of sense because in the real world boxes have a fixed size and the padding goes on the inside. The more padding you add, the less room there would be for the content.
Below is an image which shows this.

The width of you object is actually 60px, but the padding is added to that, so 5px on either side is added, and thus the apeared width is 70px. but this is if there isn't a border involved. the border width is also added to the total width of the 'box'. Now the margin, can be seen as an invisable barrier and it will push the box away from everything if it trys to go inside the the margin. hehe a nice way to think about it i think.
This was just a quick one, so i probs said something wrong. so please correct me if you feel i made a mistake.
IE, instead of measing just the width of the content, takes the width property as the sum of the width of the content, padding and borders. This actually makes alot of sense because in the real world boxes have a fixed size and the padding goes on the inside. The more padding you add, the less room there would be for the content.
Below is an image which shows this.

The width of you object is actually 60px, but the padding is added to that, so 5px on either side is added, and thus the apeared width is 70px. but this is if there isn't a border involved. the border width is also added to the total width of the 'box'. Now the margin, can be seen as an invisable barrier and it will push the box away from everything if it trys to go inside the the margin. hehe a nice way to think about it i think.
This was just a quick one, so i probs said something wrong. so please correct me if you feel i made a mistake.