Open In App

Difference between <nav> and <menu> tag in HTML5

“<nav>” Tag: The <nav> tag is used to specify navigation links either within the same document or any other document which means it provides link to contents which are either on same or different page/document.

Example:




<!DOCTYPE html>
<html>
  
<body>
    <h1>The nav element</h1>
    <p>The nav element defines navigation links:</p>
    <nav>
        <a href=”/home/”>HOME</a> |
        <a href=”/category/”>CATEGORY</a> |
        <a href=”/profile/”>PROFILE</a> |
    </nav>
</body>
  
</html>

Output:



Example:




<!DOCTYPE html> 
<html
<head
    <title>nav tag</title
    <style
        nav { 
            border:2px; 
            background-color:#090; 
            color:white; 
            padding:8px; 
        
        a {  
            color:white; 
            font-size:25px; 
        
        .gfg { 
            font-size:30px; 
            color:#090; 
            font-weight:bold; 
            text-align:center; 
        
        .nav_tag { 
            text-align:center; 
               
        
    </style
</head
<body
    <div class = "gfg">GFG</div
    <div class = "nav_tag">Nav Element Example</div
    <nav
        <a href
                        Home</a> |
        <a href
          Difference Between</a> |
          
        <a href
                    Interview</a> |
                <a href
                      Courses</a> |
  
    </nav
</body
</html

Output:

<menu> Tag: The <menu> tag in HTML is used for creating menu lists. It defines a list of commands which can be used by the users to create listing form control, toolbar, context menus, and commands. The <menu> tag was removed from HTML and reintroduced in HTML5. It is not supported on the majority of platforms.



Contents of “menu” tags:

Article Tags :