HTML 4和HTML 5的关键区别是什么? [英] What's the key difference between HTML 4 and HTML 5?

查看:89
本文介绍了HTML 4和HTML 5的关键区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTML4 HTML5草稿



请保留与更改相关的答案语法和添加/删除的html元素。

解决方案

HTML5有几个不同于HTML4的目标。 b

处理格式错误的文档的一致性



主要的是一致的,定义的错误处理。如您所知,HTML特意支持标签汤,或者编写格式错误的代码并将其更正为有效的文档。问题是这样做的规则不会在任何地方写下来。当一个新的浏览器供应商想要进入市场时,他们只需在各种浏览器(尤其是IE)中测试格式错误的文档,并对其错误处理进行逆向工程。如果他们不这样做,那么很多页面将无法正确显示(估计网页上大约90%的网页至少有些不正常)。所以, HTML5正试图发现并编纂这种错误处理方式,以便浏览器开发人员能够实现标准化并大大减少持续显示内容所需的时间和金钱。另外,在HTML作为文档格式去世后的未来,历史学家可能仍然希望阅读我们的文档,并且拥有完全定义的分析算法将极大地帮助这一点。



< h1>更好的Web应用程序功能

HTML5的次要目标是通过HTML,CSS和Javascript开发浏览器成为应用程序平台的能力。许多元素已直接添加到当前(基于HTML4)基于Flash或基于JS的黑客(如< canvas> << ;视频> <音频> 。有用的东西,如本地存储(一个js可访问的浏览器内置键值数据库,用于存储超出cookie可以容纳的信息),新的输入类型(如浏览器可以暴露的简单用户界面的日期)不必使用我们基于js的日历日期选择器),并且支持浏览器的表单验证将使开发人员的开发Web应用程序变得更加简单,并且使用户能够为用户提供更快的速度(因为许多事情将在本地支持,而不是通过javascript攻击)。



改进的元素语义



还有许多其他更小的努力发生在HTML5,例如现有元素(< strong> < em> >)的更好定义的语义角色实际上意思是不同的,甚至< b> < i> 具有模糊的语义,遗留文档)并添加有用语义的新元素 - & lt; article> < section> < header> < aside> < nav> 应取代大部分< div> 在网页上使用,使您的页面更加语义化,但更重要的是,更易于阅读。没有更多痛苦的扫描来查看随机< / div> 是否正在关闭 - 相反,您会看到< / header> < / article> ,使文档结构更加直观。


What are the key differences between HTML4 and HTML5 draft?

Please keep the answers related to changed syntax and added/removed html elements.

解决方案

HTML5 has several goals which differentiate it from HTML4.

Consistency in Handling Malformed Documents

The primary one is consistent, defined error handling. As you know, HTML purposely supports 'tag soup', or the ability to write malformed code and have it corrected into a valid document. The problem is that the rules for doing this aren't written down anywhere. When a new browser vendor wants to enter the market, they just have to test malformed documents in various browsers (especially IE) and reverse-engineer their error handling. If they don't, then many pages won't display correctly (estimates place roughly 90% of pages on the net as being at least somewhat malformed).

So, HTML5 is attempting to discover and codify this error handling, so that browser developers can all standardize and greatly reduce the time and money required to display things consistently. As well, long in the future after HTML has died as a document format, historians may still want to read our documents, and having a completely defined parsing algorithm will greatly aid this.

Better Web Application Features

The secondary goal of HTML5 is to develop the ability of the browser to be an application platform, via HTML, CSS, and Javascript. Many elements have been added directly to the language that are currently (in HTML4) Flash or JS-based hacks, such as <canvas>, <video>, and <audio>. Useful things such as Local Storage (a js-accessible browser-built-in key-value database, for storing information beyond what cookies can hold), new input types such as date for which the browser can expose easy user interface (so that we don't have to use our js-based calendar date-pickers), and browser-supported form validation will make developing web applications much simpler for the developers, and make them much faster for the users (since many things will be supported natively, rather than hacked in via javascript).

Improved Element Semantics

There are many other smaller efforts taking place in HTML5, such as better-defined semantic roles for existing elements (<strong> and <em> now actually mean something different, and even <b> and <i> have vague semantics that should work well when parsing legacy documents) and adding new elements with useful semantics - <article>, <section>, <header>, <aside>, and <nav> should replace the majority of <div>s used on a web page, making your pages a bit more semantic, but more importantly, easier to read. No more painful scanning to see just what that random </div> is closing - instead you'll have an obvious </header>, or </article>, making the structure of your document much more intuitive.

这篇关于HTML 4和HTML 5的关键区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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