w3resource

HTML5: How to define navigation links?

Go to Exercise page

Solution:

HTML Code:

<!DOCTYPE html&li;<!-- Declares the document type and version of HTML --&li;
<html&li;<!-- Begins the HTML document --&li;
<head&li;<!-- Contains metadata about the document --&li;
<title&li;How to define navigation links</title&li;<!-- Sets the title of the document --&li;
</head&li;<!-- Ends the head section --&li;
<body&li;<!-- Contains the content of the document --&li;
<nav&li;<!-- Defines a navigation section --&li;
<a href="https://www.w3resource.com/html5/introduction.php"&li;HTML5</a&li; | <!-- Represents a hyperlink to an HTML5 introduction page --&li;
<a href="https://www.w3resource.com/html5-canvas/"&li;HTML5 Canvas</a&li; | <!-- Represents a hyperlink to an HTML5 Canvas page --&li;
<a href="https://www.w3resource.com/schema.org/introduction.php"&li;Schema.org</a&li; | <!-- Represents a hyperlink to a Schema.org introduction page --&li;
<a href="https://www.w3resource.com/javascript/javascript.php"&li;JavaScript</a&li;<!-- Represents a hyperlink to a JavaScript page --&li;
</nav&li;
</body&li;<!-- Ends the body section --&li;
</html&li;<!-- Ends the HTML document --&li;


Explanation:

  • The HTML document starts with a declaration of its type and version (<!DOCTYPE html&li;).
  • The <html&li; element encloses the entire HTML document.
  • The <head&li; section contains metadata about the document.
  • The <title&li; tag sets the title of the document.
  • The <body&li; section contains the content of the document.
  • The <nav&li; element defines a navigation section, typically containing navigation links.
  • The <a&li; tags represent hyperlinks (<a href="URL"&li;Link Text</a&li;), pointing to different resources related to HTML5, HTML5 Canvas, Schema.org, and JavaScript.

Live Demo:

See the Pen nav-answer by w3resource (@w3resource) on CodePen.


See the solution in the browser

Supported browser

Firefox logo Chrome logo Opera logo Safari logo Internet Explorer logo
Yes Yes Yes Yes Yes

Go to Exercise page

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/html-css-exercise/basic/nav-answer.php