I designed a web page with lot of CSS properties, and when viewing it in IE its alignment is not so proper compared to all other browsers.
For the next time, what are the CSS properties I should tak开发者_如何学Ce care with in IE?
Thank you.
If you have a div
with a margin floated to the same side, it will cause a double margin in IE:
div
{
margin-left: 10px;
float: left;
}
or
div
{
margin-right: 10px;
float: right;
}
The margin will in fact be 20px in IE.
The fix is to add display:inline
.
Very nearly everything breaks IE.
First thing to say is that you should make sure your HTML code always has a <!DOCTYPE>
declaration. This will force it into "standards mode", which makes IE much more consistent with other browsers. (it's still got tons of missing and broken features, but its nothing compared to the disaster you'll get without a doctype).
For finding out what those missing and broken features are, I recommend you take a look at http://www.quirksmode.org/css/contents.html.
The Quirksmode site has an excellent set of tables showing exactly which CSS properties and other functionality work in which browsers. It also has details of exactly what the bugs are in specific cases. If I ever have a question like this, Quirksmode is the first place I go to find the answer.
The second place I go to find the answer is http://caniuse.com/. However this site focusses more on newer features, so may not tell you everything you need to know.
Stay clear of using the following, it doesnt play nice in ie.
display:inline-block
精彩评论