什么是处理CSS浏览器兼容的正确方法? [英] What is the correct way to deal with css browser compatibility?

查看:112
本文介绍了什么是处理CSS浏览器兼容的正确方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是更好地为每个用户代理不同的CSS文件,或者是它最好使用CSS黑客只有某些浏览器可以看到什么?

Is it better to have a different CSS file for each user-agent or is it better to use CSS Hacks that only certain browsers can see?

推荐答案

都不是。

最好是写code,在所有的浏览器,而无需浏览器的专用code或CSS黑客作品。这当然不是很容易做到,这就是为什么很多人用其他方法。

The best is to write code that works in all browsers without the need of browser specific code or css hacks. It's of course not quite as easy to accomplish, which is why many people use the other methods.

关键是要避免的事情,有些浏览器(经常Internet Explorer)中有问题。这样的一个事情就是用填充,而不是利润率,因为IE不处理保证金正确崩溃。

The key is to avoid things that some browsers (very often Internet Explorer) has problems with. One such thing is to use padding rather than margin, because IE doesn't handle margin collapsing correctly.

一些方法,在被黑客攻击的边界线使用code,不影响正常工作,浏览器,但修复了一个特定的浏览器的问题。这可能是一些类似规定为通常不需要,或者指定显示元素的高度:内联浮动元素

Some methods that is in the border line of being hacks is using code that doesn't affect browsers that work correctly, but fixes problems for a specific browser. That could be things like specifying a height for an element that normally shouldn't need one, or specifying display:inline on a floating element.

页面位置是有一些错误的例子和建议的修复一切。 (通常情况下,解决办法是某种黑客,所以你当然应该也可以考虑,如果你可以完全避免这个问题。)

The page Position is everything has examples of some bugs and suggested fixes. (Often the fix is some kind of hack, so you should of course also consider if you can avoid the problem altogether.)

这篇关于什么是处理CSS浏览器兼容的正确方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆