< nav>和有什么区别?和< div&gt ;? [英] What is the difference between <nav> and <div>?

查看:120
本文介绍了< nav>和有什么区别?和< div&gt ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一组链接,我可以使用<div>代替<nav>吗?

Let's say I have a set of links, can I use <div> instead of <nav>?

<div>
  <ul>
   <li class="head_divider">...</li>
   <li class="head_divider">Text<br />Here</li>
   <li class="head_divider">...</li>
 </ul>

两者之间有什么区别?他们为我产生相同的格式/答案

What is the difference between the two? they yield the same format/answer for me

推荐答案

  • <nav>意味着更多的语义标记(让浏览器知道) 这些链接不只是普通的链接,它们是一个导航 菜单.这对于辅助功能(标签,移动设备 设备,浏览器(例如适合残障用户的屏幕阅读器)可以使用 此元素确定是否忽略初始渲染 此内容.)和其他内容.

    • <nav> meant for more semantic markup (letting the browser know) that those links aren't just normal links, they are a navigation menu. This can be useful for accessibility (tabs, mobile devices,browsers, such as screen readers for disabled users, can use this element to determine whether to omit the initial rendering of this content.) and other things.

      有关<nav>的更多参考: https://www.w3.org/TR/html51/sections .html#the-nav-element

      <div>标记定义HTML文档中的分隔或部分. 它是一个块级元素,通常用于识别大型 内容分组,有助于构建网页布局 并使用CSS进行设计.

      The <div> tag defines a division or a section in an HTML document. It is a block-level element that is commonly used to identify large groupings of content, and which helps to build a web page’s layout and design using CSS.

      有关<div>的更多参考信息: http://www.html- 5-tutorial.com/div-tag.htm

      For more reference on <div> : http://www.html-5-tutorial.com/div-tag.htm

      在样式方面没有太大区别,

      When it comes to styling there is no big difference,

      <nav>

      <div>

      这篇关于&lt; nav&gt;和有什么区别?和&lt; div&gt ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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