Contents  >

Bootstrap Menu and Footer

Learning Goals

At the end of this Tutorial you will be able to:

You can view a finished version of the Bootstrap menu and footer web page you will work in this Tutorial by clicking the image or text link below. The finished web page will open in a new tab of your web browser.

Sample image bootstrap-menu-footer.html

Contents

Overview of navigation menus

About the Bootstrap menu system

Downloading your sample files

Downloading the placeholder logo image

Inspecting the Bootstrap navbar

The navbar background colour

The website logo

The hamburger icon

Text menu links

The ‘call-to-action’ button

Making your menu ‘sticky’

About the Bootstrap footer

Uploading your Bootstrap folder to GitHub

About the Bootstrap menu system

The Bootstrap CSS and JavaScript files include features that make it easy to create and modify website menus.

One such feature is that Bootstrap automatically converts desktop/laptop menus to drop-down mobile menus automatically, depending on the width of the user's screen.

Project Navigation Menus

Downloading your sample files

In this exercise, you will work with the following web page and stylesheet:

You have now saved the web page and stylesheet you need for this Tutorial.

Downloading the placeholder logo image

A menu will typically include a logo image. Right-click on the placeholder logo below, choose Save Image As from the context menu, and download it to your C:/websites/bootstrap/assets/img sub-folder.

 
 


When you use this sample menu web page in a website, you will replace this image with the actual logo image of the website.

Inspecting the Bootstrap navbar

In your web browser, display the bootstrap-menu-footer.html web page.

In VS Code, open the bootstrap-menu-footer.html file and the bootstrap-menu-footer.css stylesheet.

Let's review some elements of the Bootstrap menu system.

The navbar background colour

In the navbar block at the top of the bootstrap-menu-footer.html web page, you can see two classes navbar-dark and bg-dark. These, working together, control the background colour of the navbar.

Introduction to HTML

If you prefer a navbar with a light background, replace these classes with navbar-light and bg-light as shown below. Introduction to HTML

When you change the navbar background from dark to light, the colour of the hyperlinks in the navbar also changes accordingly. In this way, the text of the menu links is always visible against the navbar background.

You can edit the dark or light background colour of the navbar in the bootstrap-menu-footer.css stylesheet.

Introduction to HTML

To apply a transparent background to a navbar, replace the two dark or light coloured background classes with a single class named navbar-transparent.

Introduction to HTML

The first item within the navbar is the logo of the website. Your sample web page includes an image named website-logo.png. This sample logo is 200 pixels high and 40 pixels wide.

This logo image is one image you do not want the web browser to resize according to the width of the user's screen. For this reason, the logo's dimensions are set in the web page where they cannot be overwritten by a setting in a stylesheet.

Introduction to HTML

The hamburger icon

The so-called hamburger icon that is displayed at the right of the Bootstrap menu on mobile screens is provided by the Font Awesome icon set. For this reason, a web page that includes a Bootstrap menu must include a link to Font Awesome stylesheet in the head of the web page.

Introduction to HTML

Each of the text hyperlinks in the navbar is created as an item in a HTML bulleted list. You can edit the text displayed (Link 1, Link 2, ...) and also the link destination.

Introduction to HTML

To add a new menu option, just add a further HTML list item. Conversely, to remove a menu option, just delete the bulleted item.

The ‘call-to-action’ button

The final menu option is typically styled as a button with an icon.

Introduction to HTML

Making your menu ‘sticky’

A so-called sticky menu is one that remains fixed at the top of the desktop/laptop or mobile screen, even as the user scrolls down through the web page. This makes it easier for the user to navigate to other pages on the website.

Let's make the menu on your sample web page sticky:

  1. In VS Code, display the bootstrap-menu-footer.html web page.
  2. In the navbar block at the top of the web page, add the Bootstrap class of sticky-top as shown below. Introduction to HTML

Uploading your Bootstrap folder to GitHub

Follow these steps below to upload your entire Bootstrap folder to your website on GitHub.

  1. Open a new tab in your web browser and go to GitHub.com. If you are not already signed in to your GitHub account, sign in now. github-signin
  2. On your GitHub home page, click the name of the repository (‘repo’) that holds your web pages. Its name will look as follows, where username is your chosen username on GitHub.   username.github.io github-signin
  3. On the next GitHub screen displayed, click the Add file button near the right of the screen and choose Upload files from the dropdown list. github-upload-portfolio
  4. In File/Windows Explorer, select your bootstrap folder, and drag-and-drop it to your repository on GitHub. Introduction to Images
  5. Scroll down to the bottom of the GitHub screen, and accept or edit the short message (Add files via upload) in the Commit changes box.   Finally, click the green Commit changes button to upload your entire bootstrap folder and all the files it contains.

Your uploaded web page is published on GitHub at a web address similar to the following, where username is the username you have chosen for your GitHub account:

https://username.github.io/bootstrap/bootstrap-menu-footer.html

It may take a few minutes for your uploaded files to appear on GitHub.