开发者

What CSS properties are likely to cause problems in Internet Explorer? [closed]

开发者 https://www.devze.com 2023-01-31 00:53 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

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
0

精彩评论

暂无评论...
验证码 换一张
取 消