Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Navigation | Advanced Concepts
course content

Course Content

Bootstrap: Building Stylish Websites

NavigationNavigation

Navbars

Navbars are responsive navigation headers commonly used to provide site navigation links, branding, and other interactive elements.

Key Features

Navbars are designed to be responsive and will automatically collapse into a mobile-friendly menu when viewed on smaller screens. They are capable of supporting various types of content, including navigation links, brand logos, search bars, dropdown menus, and buttons.

Usage

  • Start by incorporating the navbar class to establish the basic structure of your navbar;
  • Enhance your navbar by adding specific elements such as navbar-brand for branding, navbar-nav for navigation links, navbar-toggler for the responsive toggle button, and collapse for collapsible content;
  • Personalize the appearance of your navbar further by applying additional classes like bg-dark to set the background color.
html

index.html

css

index.css

js

index.js

Code Description
  1. Navbar Container (nav):
    • Bootstrap class navbar defines the navigation bar.
    • navbar-expand-lg makes the navbar expand to full width on large screens and collapse on smaller screens.
    • navbar-dark bg-dark sets the navbar to have dark background and text color.
  2. Brand/Logo (a):
    • Represents the brand or logo of the website. Clicking on it typically takes the user to the homepage.
  3. Toggler Button (button):
    • A button that toggles the visibility of the navbar links on small screens.
    • data-bs-toggle="collapse" and data-bs-target="#navbarSupportedContent": Bootstrap attributes to toggle the collapsible content.
    • navbar-toggler-icon: Icon displayed on the button to indicate the toggling functionality.
  4. Navbar Links (<div class="collapse navbar-collapse" ...>):
    • Container for navbar links that collapse on smaller screens.
    • navbar-collapse class collapses the navbar content when the screen is resized.
    • id="navbarSupportedContent": Corresponds to the data-bs-target attribute of the toggler button.
    • ml-autoclass aligns the navbar links to the right.
  5. Navbar Links (<ul class="navbar-nav ml-auto">):
    • <ul class="navbar-nav ml-auto">: Unordered list containing the navbar links.
    • navbar-nav class defines a list of navigation items.
    • ml-auto class aligns the list items to the right.
  6. Individual Navbar Links (<li class="nav-item">):
    • Each list item represents a navigation link.
    • nav-item class defines a navigation item.
    • active class marks the active navigation item.
    • <a class="nav-link" href="#">Home</a>: Defines a navigation link. nav-link class styles the link.

Navs

Navs are versatile navigation components that can be used for various navigation purposes, such as tabbed navigation, pill navigation, or vertical navigation.

Key Features

Navs can be utilized for both horizontal and vertical navigation layouts and support various styles, such as tabs, pills, and justified navigation.

Usage

  • Start by incorporating the nav class to create a basic nav structure;
  • Populate your nav with navigation items using <a> or <button> elements, each with the nav-item class;
  • Further enhance the appearance and functionality of your nav by applying additional classes such as nav-tabs for tab navigation or nav-pills for pill navigation.
html

index.html

css

index.css

js

index.js

Code Description
  1. Navigation Tabs (<ul class="nav nav-tabs" ...>):
    • Bootstrap classes nav and nav-tabs are used to create a tabbed navigation menu.
  2. Individual Tab Items (<li class="nav-item" ...>):
    • Each list item represents a tab in the tabbed navigation.
    • nav-item class is used to style the tab item.
  3. Tab Links (<a class="nav-link" ...>):
    • Each <a> element within the list item represents a tab link.
    • nav-link class is used to style the tab link.
    • data-bs-toggle="tab" attribute enables tab behavior.
    • href attribute points to the ID of the associated tab content.
    • role="tab" attribute specifies the role of the link.
    • aria-controls attribute specifies the ID of the associated tab content.
    • aria-selected attribute indicates whether the tab is selected.
  4. Active Tab (<a class="nav-link active" ...>):
    • The tab with the active class is the default active tab.
    • aria-selected="true" attribute indicates that this tab is selected by default.
  5. Unique IDs and Href Attributes:
    • Each tab link (<a>) has a unique id attribute (home-tab, profile-tab, contact-tab) that corresponds to the href attribute of the associated tab content.

Everything was clear?

Section 4. Chapter 1
course content

Course Content

Bootstrap: Building Stylish Websites

NavigationNavigation

Navbars

Navbars are responsive navigation headers commonly used to provide site navigation links, branding, and other interactive elements.

Key Features

Navbars are designed to be responsive and will automatically collapse into a mobile-friendly menu when viewed on smaller screens. They are capable of supporting various types of content, including navigation links, brand logos, search bars, dropdown menus, and buttons.

Usage

  • Start by incorporating the navbar class to establish the basic structure of your navbar;
  • Enhance your navbar by adding specific elements such as navbar-brand for branding, navbar-nav for navigation links, navbar-toggler for the responsive toggle button, and collapse for collapsible content;
  • Personalize the appearance of your navbar further by applying additional classes like bg-dark to set the background color.
html

index.html

css

index.css

js

index.js

Code Description
  1. Navbar Container (nav):
    • Bootstrap class navbar defines the navigation bar.
    • navbar-expand-lg makes the navbar expand to full width on large screens and collapse on smaller screens.
    • navbar-dark bg-dark sets the navbar to have dark background and text color.
  2. Brand/Logo (a):
    • Represents the brand or logo of the website. Clicking on it typically takes the user to the homepage.
  3. Toggler Button (button):
    • A button that toggles the visibility of the navbar links on small screens.
    • data-bs-toggle="collapse" and data-bs-target="#navbarSupportedContent": Bootstrap attributes to toggle the collapsible content.
    • navbar-toggler-icon: Icon displayed on the button to indicate the toggling functionality.
  4. Navbar Links (<div class="collapse navbar-collapse" ...>):
    • Container for navbar links that collapse on smaller screens.
    • navbar-collapse class collapses the navbar content when the screen is resized.
    • id="navbarSupportedContent": Corresponds to the data-bs-target attribute of the toggler button.
    • ml-autoclass aligns the navbar links to the right.
  5. Navbar Links (<ul class="navbar-nav ml-auto">):
    • <ul class="navbar-nav ml-auto">: Unordered list containing the navbar links.
    • navbar-nav class defines a list of navigation items.
    • ml-auto class aligns the list items to the right.
  6. Individual Navbar Links (<li class="nav-item">):
    • Each list item represents a navigation link.
    • nav-item class defines a navigation item.
    • active class marks the active navigation item.
    • <a class="nav-link" href="#">Home</a>: Defines a navigation link. nav-link class styles the link.

Navs

Navs are versatile navigation components that can be used for various navigation purposes, such as tabbed navigation, pill navigation, or vertical navigation.

Key Features

Navs can be utilized for both horizontal and vertical navigation layouts and support various styles, such as tabs, pills, and justified navigation.

Usage

  • Start by incorporating the nav class to create a basic nav structure;
  • Populate your nav with navigation items using <a> or <button> elements, each with the nav-item class;
  • Further enhance the appearance and functionality of your nav by applying additional classes such as nav-tabs for tab navigation or nav-pills for pill navigation.
html

index.html

css

index.css

js

index.js

Code Description
  1. Navigation Tabs (<ul class="nav nav-tabs" ...>):
    • Bootstrap classes nav and nav-tabs are used to create a tabbed navigation menu.
  2. Individual Tab Items (<li class="nav-item" ...>):
    • Each list item represents a tab in the tabbed navigation.
    • nav-item class is used to style the tab item.
  3. Tab Links (<a class="nav-link" ...>):
    • Each <a> element within the list item represents a tab link.
    • nav-link class is used to style the tab link.
    • data-bs-toggle="tab" attribute enables tab behavior.
    • href attribute points to the ID of the associated tab content.
    • role="tab" attribute specifies the role of the link.
    • aria-controls attribute specifies the ID of the associated tab content.
    • aria-selected attribute indicates whether the tab is selected.
  4. Active Tab (<a class="nav-link active" ...>):
    • The tab with the active class is the default active tab.
    • aria-selected="true" attribute indicates that this tab is selected by default.
  5. Unique IDs and Href Attributes:
    • Each tab link (<a>) has a unique id attribute (home-tab, profile-tab, contact-tab) that corresponds to the href attribute of the associated tab content.

Everything was clear?

Section 4. Chapter 1
some-alt