Why use HTML5 tags? [duplicate]

二次信任 提交于 2019-11-27 05:27:18

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.

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!