+ 1
Navigation tag
How does the navigation tag <nav> work with # tag?
6 Réponses
+ 3
i think you mean links: <a>
it is not related to the <nav> tag; you can use links anywhere.
+ 3
Here's an example of how to use the <nav> tag to create a basic navigation section:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML nav Tag</title>
</head>
<body>
<h2>HTML nav Tag</h2>
<!-- nav tag starts -->
<nav>
<a href="#">Home</a> |
<a href="#">Interview</a> |
<a href="#">Languages</a> |
<a href="#">Data Structure</a> |
<a href="#">Algorithm</a>
</nav>
<!-- nav tag ends -->
</body>
</html>
+ 3
The <nav> tag is supported by most browsers, including Google Chrome 5.0, Edge 12, Mozilla 4.0, Safari 5.0, and Opera 11.1.
It's worth noting that not all groups of links on a page need to be in a <nav> element — only sections that consist of major navigation blocks are appropriate for the <nav> element.
+ 2
The <nav> tag in HTML is used to define a section of navigation links, which can be used to navigate within the current document or to other documents. It's a semantic element that provides a way to organize and present links for user navigation.
0
The `<nav>` tag is used to define a section of a webpage for navigation links. It helps organize links and improve accessibility.
### Example:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Navigation Example</title>
</head>
<body>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#services">Services</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<section id="home">
<h1>Home</h1>
<p>Welcome to our website.</p>
</section>
<section id="about">
<h1>About</h1>
<p>Learn more about us.</p>
</section>
<section id="services">
<h1>Services</h1>
<p>Discover our services.</p>
</section>
<section id="contact">
<h1>Contact</h1>
<p>Get in touch with us.</p>
</section>
</body>
</html
0
How to use section id