liveBook · Manning

Nav element

As explained in Build a Website with ChatGPT

An HTML element that identifies a section of a document containing navigation links.

The HTML <nav> element marks an area for navigation, usually links to other pages or sections of a site. It can appear anywhere on a page, but often sits after the <header> and before the <main> content. section 12.2.1

A five-link navigation bar

<nav> <a href="index.html">Home</a> <a href="blog.html">Blog</a> <a href="faq.html">FAQ</a> <a href="about.html">About</a> <a href="contact.html">Contact</a> </nav> The <nav> tags surround the links. Each link’s href names the page it opens. To have ChatGPT make one for your site, specify each link’s visible text and destination filename in your prompt. section 6.2.2

A navigation bar can be styled separately from its links. For example, `nav { display: flex; justify-content: space-between; }` places the links in a horizontal row and spaces them across the bar. If many links make the bar too wide on a phone, a menu that opens when tapped is another option. section 6.2.2

Navigation belongs in more than home pages: an article page can keep links to the site’s main areas above its article. A course catalog can also use a navigation element to hold filtering, sorting, and search controls. section 12.2.10 section 13.5

How Build a Website with ChatGPT covers it

How deep it goes
Defines the element, shows link markup and basic Flexbox styling, and defers detailed Flexbox and small-screen menu construction.
Examples
Shows a five-link Home, Blog, FAQ, About, and Contact bar and prompts for navigation on home and article pages.
What it assumes
Assumes no coding knowledge and introduces the tags and links needed for a basic navigation bar.
What you can do after
Apply it via ChatGPT by specifying link text and destination files, then check the generated <nav> markup.
How it connects
Connects HTML links with header and main layout elements, CSS Flexbox, and responsive menus.

Also explained in

Compare how 2 books explain nav element →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Website with ChatGPT. The section links point to the parts of the book it draws on.