我可以在 HTML5 和 CSS3 中自由使用什么?我应该避免哪些功能?
我可以在 HTML5 和 CSS3 中使用哪些功能,而无需过多考虑 IE6 和类似的功能?我应该避免哪些功能?
What features can I use in HTML5 and CSS3 without thinking too much about IE6 and similar? What features should I avoid?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
定义“太多”。 HTML 4 和 CSS 1 中的任何内容都会构成非常安全的基线……
更实际的说明 caniuse 会告诉您什么时候添加了对特定功能的支持。然后您需要决定它是否会完全降解。
也就是说,不要去寻找要使用的 HTML 5 / CSS 3 / 等功能。如果您遇到问题,请寻找解决方案。不要寻找解决方案,然后尝试找到问题来解决它。
Define "too much". Anything that is in HTML 4 and CSS 1 makes for a very safe baseline…
On a more practical note caniuse will tell you when support for a particular feature has been added. You then need to decide if it will degrade cleanly or not.
That said, don't go looking HTML 5 / CSS 3 / etc features to use. If you have a problem, look for a solution. Don't look for a solution and then try a find a problem to solve with it.
当您想要使用某个特定功能时,http://www.caniuse.com/ 是一个很好的资源- 但不确定浏览器兼容性。
此外,许多 HTML5/CSS3 功能都有附加链接,其中包含有关我可以使用的更多信息。
http://www.caniuse.com/ is a great resource when you have a particular feature in mind to use - but are but sure the of browser compatibility.
In addition, many HTML5/CSS3 features have additional links with further information available on Can I Use.
Paul Irish 有一个很棒的评论 HTML5 样板。
来自“为什么它很棒”:
Paul Irish has an awesome commented HTML5 Boilerplate.
From "Why it is awesome":
用IE6打开这个网站,发现:http://html5test.com/
(我没有安装IE6,所以我无法为您检查 atm)
您可能还想看看: HTML5 跨浏览器 Polyfill。
Open this website in IE6 and find out: http://html5test.com/
(I don't have IE6 installed so I can not check it for you atm)
You also might wanna have a look at: HTML5 Cross Browser Polyfills.
我想你必须避免很多事情:-)
我首先要避免:
- 拖放API,
- 文件API
I guess you have to avoid many things :-)
I would start by avoiding:
- Drag and Drop API,
- File API
Quirksmode 一直让我受益匪浅。
我认为你的问题应该更具体一些 - 我不担心 IE 兼容性,所以我会说全部使用它们。但是我知道视图并不是所有人共享的,所以我认为更好的答案是全部使用它们,直到遇到与目标浏览器/操作系统明确不兼容的视图
一旦您开始看到出现问题,然后努力纠正它们。
我会再说一遍 - 将受支持的浏览器/操作系统的特定列表放在一起,您的情况会好得多(提示 - 如果您想使用其中的大部分功能,则不支持
Quirksmode has always done me well.
I think you should be a little more specific in your question - I don't worry about IE compatibility so I would say use them All. However I know that view is not shared by all, So i think a better answer would be use them all until you run into one that explicitly is not compatible with your target browsers / os
Once you start to see problems then work on correcting them.
I will say it once again - put together a specific list of supported browsers / os and you will be much much better off (hint - don't support < IE9 if you want to use the majority of these features)
HTML5 doctype (
) 在 IE 6 中工作得很好(因为它将 IE 6 放入 标准模式)。
除此之外,我认为 IE 6 几乎不支持 HTML5 或 CSS3 中的任何新内容(除了
@font-face
),因此您至少必须确定 IE 6 中的体验是否良好就足够好了。不过,有用的是,新功能在 IE 6 中通常不会产生任何负面影响。例如,新的
类型,如
< /code> 将像 IE 6 中的
一样呈现。因此,您必须决定仅使用简单的文本输入是否适合 IE 6 用户,或者是否需要提供使用 JavaScript 的日期选择功能。
这几乎是所有 HTML5/CSS3 功能的问题 - 旧版浏览器的用户可以不用它们,还是需要添加替代实现?
主要的例外是 HTML5 中的新标签 - Internet Explorer 6 不允许您设置样式它不知道的标签,除非您使用 JavaScript 创建该标签的实例。 (HTML 4 标签
也是如此,因为 IE 由于某种原因也不知道这一点。)
The HTML5 doctype (
<!doctype html>
) works just fine in IE 6 (in as much as it puts IE 6 into standards mode).Aside from that, I think pretty much nothing new in HTML5 or CSS3 (apart from
@font-face
) is supported in IE 6, so you’ll have to at least decide whether the experience in IE 6 is good enough. Usefully though, the new features generally don’t have any negative effect in IE 6.For example, the new
<input>
types like<input type="date">
will render just like<input type="text">
in IE 6. So you’ll have to decide whether just having a simple text input is fine for IE 6 users, or whether you need to provide date-picking functionality using JavaScript.This is pretty much the question with all HTML5/CSS3 features — can users of older browsers do without them, or do you need to add an alternative implementation?
The main exception is new tags in HTML5 — Internet Explorer 6 won’t let you style tags that it doesn’t know about, unless you create an instance of that tag using JavaScript. (The same is true of the HTML 4 tag
<abbr>
, because IE for some reason doesn’t know about that either.)