Home Web Front-end H5 Tutorial Detailed explanation of nav tag in HTML5

Detailed explanation of nav tag in HTML5

Mar 14, 2017 pm 03:42 PM
html5

The

nav tag is usually used to create the navigation bar on a Web page, and can be a self-navigation for some parts of the page. Here we take a brief look at the nav in HTML5 Tag study notes:

The full name of the nav tag is navigation. As the name suggests, it means navigation. According to the relevant standards of HTML5, the definition is as follows: "A section of a page that links to other pages or to parts within the page:
a section with navigation links." The Chinese translation probably means "A section of a page that links to other pages or to parts within the page:a section with navigation links." Other pages or areas of the current page: an area containing navigation links." The function of the nav tag is very clearly defined here. Similar to head

er, it does not specify that it must be the main navigation, or it can be a sub-navigation in other parts of the page. As follows:

1

2

3

4

5

6

7

8

9

XML/HTML Code复制内容到剪贴板

<h3>gbin1.com文章列表</h3>

<nav>

    <ul>

        <li><a href="#html5">HTML5文章介绍</a></li>

        <li><a href="#css3">CSS3文章介绍</a></li>

        <li><a href="#jquery">jQuery文章介绍</a></li>

        <ul>

</nav>

Copy after login


## above In this example, we see that this is just an area of ​​article navigation. You can also use nav to define a small in-page navigation. But not all link groups on the page need to be placed within the nav tag, which is mainly composed of the main navigation block of the page. For example, we usually put a set of links in the footer of the website, including terms of service, website introduction, copyright statement, etc. At this time, we usually use footer instead of nav.
A page can contain multiple nav tags as navigation for the entire page or different parts. In the example below, there are two nav tags, one is the main navigation of the website, and the other is the auxiliary link navigation of the current page itself.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

XML/HTML Code复制内容到剪贴板

<h1>雨打浮萍</h1>

<nav>

    <ul>

        <li><a href="/">首页</a></li>

        <li><a href="#">html+css</a></li>

        ...more...  

    </ul>

</nav>

<article>

    <header>

        <h1>html5语义化标签之结构标签</h1>

        <p><span>发表于</span>2011-12-22</p>

    </header>

    <nav>

        <ul>

            <li><a href="#">子导航</a></li>

            <li><a href="#">子导航</a></li>

            ...more...  

        </ul>

    </nav>

    <p>

        <section id="public">

            <h1>section里面仍然可以再用h1标签</h1>

            <p>...more...</p>

        </section>

        <section id="destroy">

            <h1>section里面仍然可以再用h1标签</h1>

            <p>...more...</p>

        </section>

        ...more... </p>

    <footer>

        <p><a href="#">关于我们</a> |  

            <a href="#">友情链接</a> |  

            <a href="#">杂七杂八</a></p>

    </footer>

</article>

<footer>

    <p><small>© copyright 2011 </small></p>

</footer>

Copy after login


##nav tag itself does not It is not required to contain a list; it may contain other content forms.


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

XML/HTML Code复制内容到剪贴板

<nav>

    <h1>Navigation</h1>

    <p>You are on my home page. To the north lies  

        <a href="/blog">my blog</a>, from whence the sounds of battle can be heard. To the east you can see a large mountain,  

        upon which many  

        <a href="/school">school papers</a>are littered. Far up thus mountain you can spy a little figure who appears to  

        be me, desperately scribbling a  

        <a href="/school/thesis">thesis</a>.</p>

    <p>To the west are several exits. One fun-looking exit is labeled  

        <a href="http://games.example.com/">"games"</a>. Another more boring-looking exit is labeled  

        <a href="http://isp.example.net/">ISP™</a>.</p>

    <p>To the south lies a dark and dank  

        <a href="/about">contacts page</a>. Cobwebs cover its disused entrance, and at one point you see a rat run quickly  

        out of the page.</p>

</nav>

Copy after login


##

The above is the detailed content of Detailed explanation of nav tag in HTML5. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles