为什么我应该关心在 Rails 3 应用程序中使用 HTML5?

发布于 2024-10-25 03:29:31 字数 676 浏览 7 评论 0原文

首先,我问这个问题并不是故意显得天真。

但确实如此。我正在启动一个新的 Rails 项目,我希望在未来的很多年里都能够维护这个项目,并且我现在就想做出决定,尽我所能地让这个项目“面向未来”。

那么总的来说,我可以从 HTML5 中获得哪些潜在价值呢?我认为 Rails 3 位对于这个问题不太重要,但我问题的第二部分就是这样。什么是“使用”HTML5?那么如何在 Rails 3 中做到这一点呢?

据我了解,Rails3确实支持data-属性。这本身就足够好吗?

html5boilerplate 怎么样?我只花了很少的时间研究 html5boilerplate,但似乎里面发生了很多事情。那里面究竟有什么?我看到 github 上有一个 Rails3html5 项目,但没有文档可以帮助我理解“为什么?”。

总而言之,我正在寻找足够熟悉 HTML5 的人来解释为什么有人希望/需要在 HTML5 生命周期的这个阶段担心它。 “因为它又新又闪亮!”这不是一个好的答案。

解释 html5boilerplate 如何/为什么会/应该与 Rails3 项目结合起来也很好。

First, I'm really not intentionally trying to sound naive in asking that question.

But really though. I'm starting a new Rails project that I expect to maintain for many years to come, and I want to make decisions now that "future-proof" the project as best I can.

So what potential value do I stand to gain from HTML5 in general? I suppose the Rails 3 bit is less important to that question, but the second part of my question is just that. What constitutes "using" HTML5? And how do you go about doing it in Rails 3?

From what I understand, Rails3 does support the data- attributes. Is that in of itself good enough?

What about html5boilerplate? I've only spent a small amount of time looking into html5boilerplate, but it seems like a lot of stuff going on in there. And what exactly is in there anyways? I see that there's a Rails3html5 project on github, but there's no documentation to help me understand the "Why?".

So to summarize, I'm looking for someone familiar with HTML5 enough to explain why someone would want/need to worry about HTML5 at this point in its lifecycle. "Because it's new and shinny!" isn't a good answer.

Explaining how/why html5boilerplate would/should tie into a Rails3 project would also be nice.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

箜明 2024-11-01 03:29:31

您应该使用 HTML 5,不是因为它新颖、闪亮,而是因为它是未来。如果你不为未来做计划,你迟早要迁移。 HTML5 现在并不是 alpha 版本,它现在正在被浏览器大量实现。现在就让您的网站兼容 HTML5,您不仅会处于领先地位,而且无需在数月/数年后追赶。

我不会向您抛出新的/闪亮的原因,但是规格提供了非常有用的功能,例如离线存储、本机视频和音频、地理位置、更好的表单元素等。所以您不仅会领先于潮流,但您将为您的用户提供很棒的新功能。

仅供参考,以下是当今浏览器中与 HTML5 功能的兼容性的比较图表。 http://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28HTML5%29

You should use HTML 5 not because it's new and shiny, but it is the future. If you don't plan for the future, your going to have to migrate sooner or later. It's not like HTML5 is in alpha version right now, it is being implemented heavily by browsers now. By making your site HTML5 compliant now, not only will you be ahead of the curve, but you won't have to catch up months/years from now.

And I won't throw the new/shiny reason at you, however the specs offer very useful features such as Offline Storage, Native video and Audio, Geolocation, Better form elements etc etc. So not only will you be ahead of the curve, but you will be providing awesome new features for your users.

Just for reference, here is a comparison chart on compatibility with HTML5 features in browsers today. http://en.wikipedia.org/wiki/Comparison_of_layout_engines_%28HTML5%29

无法言说的痛 2024-11-01 03:29:31

HTML5 引入了新的、更有效的方法来完成许多 Web 应用程序中已成为标准的操作。

如果您现在正在创建 Web 应用程序并使用兼容的 HTML (<5),它将与基于 HTML5 的浏览器完全兼容。

关于利用任何 HTML5 特定功能的决定需要根据许多因素做出,例如您想要接触的受众和开发能力。

对于许多较大的公司/项目来说,网络开发人员仍然必须对 IE6.0 等浏览器中的功能负责。目前,设计一个依赖 HTML5 功能的网站会将其孤立于极少数受众。

另外,您应该非常清楚 HTML5 可能是未来,但它仍然是 W3C 的工作草案,并且可以接受实现者(FF、IE、WebKit 等)的大量解释。在决定要针对 HTML5 规范的哪些部分进行开发时必须小心,因为标准尚未制定。

HTML5 introduces new, more efficient ways, to do things that have become standard in many web applications.

If you are creating a web application today and using compliant HTML (<5) it will be fully compatible with an HTML5 based browser.

The decision around taking advantage of any HTML5 specific features needs to be made based on many factors, like audience you are trying to reach and development capabilities.

For many larger companies/initiatives web developers still have to answer for functionality within browsers like IE6.0. Designing a site dependent on HTML5 features isolates it to a very small audience at this time.

Also, you should be very aware that HTML5 may be the future, but it is still a Working Draft at the W3C and is open to a lot of interpretation on the part of implementors (FF, IE, WebKit, ...). Care must be taken in deciding which parts of the HTML5 spec you are developing against as the Standard isn't even set yet.

闻呓 2024-11-01 03:29:31

虽然使用 HTML5 文档类型的好处目前可能还不是很清楚,但好消息是,它不会对不使用 HTML5 任何功能的旧网站/应用程序结构造成任何损害。

简而言之,您可以暂时使用 doctype,稍后当规范达到您满意的稳定程度时再实现 HTML5“功能”。

通过这样做,您已经使您的应用程序像您最初所说的那样“面向未来”,而不会造成任何破坏。

While the benefits of using the HTML5 doctype might not be crystal clear right now, the good news is, it won't create any harm to older sites/app structures that don't use any of the features of HTML5.

Simply stated, you could just make use of the doctype for now and implement HTML5 "features" at a later time, when the specs are at a point in stability with which you are comfortable.

By doing this, you have made your app "future proof" like you initially stated without wreaking any havoc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文