HTML <nav> tag


HTML <nav> tag is used to represent a section which contains navigation links, either within current document or to another document. Examples of some navigation links are menu, table of contents, indexes, etc.

The <nav> tag is newly added tag in HTML5.

Syntax:

<nav>.....</nav>  

Following are some specifications about the HTML <nav> tag

DisplayBlock
Start tag/End tagBoth Start and End tag
UsageStructural

Example

<!DOCTYPE html>  
<html>  
<head>  
    <title>Nav Tag</title>  
    <style>  
        a{  
            text-decoration: none;  
            color: green;  
            font-size: 20px;  
            padding: 8px;  
        }  
        a:hover{  
            color: blue;  
        }  
             h1{  
        text-align: center;  
        }  
    </style>  
</head>  
<body>  
 <h1>Example of Nav tag</h1>  
<nav>  
    <a href="#">Home</a> |  
    <a href="#">Courses</a> |  
    <a href="#">About-us</a> |  
    <a href="#">Contact-us</a> |  
 </nav>  
</body>  
</html>  

Attribute:

Tag-specific attributes:

The <nav> tag does not contain any specific attribute in HTML.

Global attribute:

The <nav> tag supports the global attributes in HTML

Event attribute:

The <nav> tag supports the event attributes in HTML.


Leave a Reply

Your email address will not be published. Required fields are marked *