问题描述
可能重复:
是像 <section> 这样的新 HTML5 元素吗?和<文章>没意义?
我最终决定转向使用 HTML5 设计网站.我有一个关于新标签的问题.
I have decided to, finally, make the move to designing websites in HTML5. I have one question about the new tags.
有新的标签,例如;页眉、页脚、导航栏等.为什么这些标签比使用 DIV ID 的旧方法更受欢迎(例如 <div id="header">).我可以理解为什么这会使事情变得更简单,但是让一些使用 HTML5 的标签和一些使用旧方法的标签不会更令人困惑吗?我个人认为使用 all 或 none 比混合使用更合乎逻辑.
There are new tags such as; header, footer, navbar, etc.. Why are these tags preferred over the older method of using DIV ID's (eg. <div id="header">). I can see why this would make things simpler but wouldn't it be more confusing to have some tags that use HTML5 and some tags that use the older method? I, personally, find it more logical to use all or none, rather than a mixture.
如果我完全没有抓住重点,请告诉我.
If I'm missing the point entirely please let me know.
推荐答案
这不是非此即彼的情况.HTML5 仍然有 <div>.它仍然有 <span>s.新标签可以为您提供更多表达自由并标准化常见元素.例如,大多数页面都有导航栏,但到目前为止还没有关于如何标记的标准.如果它们被清楚地标记为 <nav>,程序就可以开始有效地使用这些信息.搜索引擎可以忽略或解析它们,而辅助技术可以帮助用户浏览网站.
It's not an either-or situation. HTML5 still has <div>s. It still has <span>s. The new tags are there to give you more expressive freedom and to standardize common elements. For instance, most pages have navigation bars, yet so far there was no standard for how those were marked up. If they're clearly marked up as <nav>, programs can start to use this information productively. Search engines can ignore or parse them and assistive technology can help the user navigate around the site.
它还使您可以更轻松地处理代码.<nav> 比 <div class="main nav foobar baz"> 更容易被发现.
It also makes it easier for you to work with your code. <nav> is so much easier to spot than <div class="main nav foobar baz">.
新标签是添加,而不是替换旧标签的全新集合.
The new tags are an addition, not an entirely new set replacing the old tags.
这篇关于为什么使用 HTML5 标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!




大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)