新的HTML5元素有优势吗? [英] Is there an advantage of the new HTML5 elements?

查看:107
本文介绍了新的HTML5元素有优势吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTML5引入了一些很好的新元素,< canvas> < audio> < video> ,这对网页设计很有用。



我不知道的是新< section> < header> < nav> 等等。

如果你是一个非常小的网页设计师,我可以看到一个用法,因为他们可能有用户代理样式表CSS规则(A像< blockquote> 类似于< div> ,只是也有边距。)



然而,如果你设计的是一个更大的网站,你可能会拥有自己的CSS规则来处理这些事情,所以没有任何好处。



那么使用这些元素有没有真正的优势?

来自Hixie的声明,HT ML5编辑器说:大多数'语义'标记的用例更容易编写和维护,特别是对于CSS中的选择器。



当作者以某种方式使用标签,标记更易于阅读和修改同事或其他使用相同标记的人员。期望(尽管承认可能)浏览器会对这些元素做任何特别的事情(除了将它们渲染为块和内联元素除外)或者搜索引擎会对它们充满热情是不现实的。


HTML5 introduces some nice new elements, <canvas>, <audio>, and <video>, that will be useful in web design.

What I don't se is the point of the new <section>, <header>, <nav>, and so on.

I can see a use if you're a very small web designer, in that they might have user agent stylesheet CSS rules (A bit like <blockquote> is similar to <div>, just has margins as well.)

However, if you're designing a bigger site, you will probably have you're own CSS rules for things like these, so there won't be any benefit.

So s there any real advantage of using these elements?

解决方案

A recent statement from Hixie, the HTML5 editor, says: "The use case for most of the ‘semantic’ markup is [just] easier authoring and maintenance, in particular for se­lec­tors in CSS."

When authors use tags in certain ways, the markup is easier to read and modify to coworkers or others who work on the same markup. It is not realistic to expect (though admittedly possible) that browsers will do anything special with these elements (except render them as blocks and not inline elements) or that search engines will get enthusiastic about them.

这篇关于新的HTML5元素有优势吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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