All of a sudden, the layout that looks neat under chrome becomes a mess under IE. To find out why, I changed the div's Background-color attribute. Finally, the width of the same div is found to be different under IE and chrome. This is a big night, it's really creepy!
After that, I did a test. When:
The code is as follows:
Div1
{
width:960px;
margin:0px;
padding:0px;
}
At this time, in two browsers is no difference! The total width is 960px.
However, when:
The code is as follows:
Div1
{
width:960px;
margin:0px;
padding:0px 10px 0px 10px;
}
At this point, Chrome will quit. She actually put the padding 20px on the outside, so that the total width of div1 is 960px+10px+10px=980px, and in IE, div1 width is still 960px;
According to my thinking, I feel padding should be counted in the width of the drop, did not expect chrome so stubborn.
After testing, border and padding, margin values are counted in the "width" of the outside.
Also, in the absence of a float, chrome will take div1 as a position:absolute, and IE will treat it as poisttion:relative; So, as far as possible, this is a block-level element of float left!
Really sad urges, the browser is not compatible let me this layman very painful!