Contents  >

Software Project:
Menus

Introduction

In this task you will use template content to add desktop and mobile menus to the ‘Software Analytics’ project you created earlier and to which you then added an email sign-up form and a footer

You can display a finished version of the project web page by clicking the image below.

Web Design Project: Software Analytics 2n2l.com Brendan Munnelly

Learning Goals

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

Contents

Introduction

Downloading the website logo image

Working with your two HTML files

Copying-and-pasting the menus HTML and JavaScript

Working with the template CSS file

Copying and renaming the template CSS file

Removing browser resets from the new menus CSS file

About the font-family for the menus

Linking your web page to the new menus CSS file

Updating the menu logo and hyperlink

Updating the menu option hyperlinks

Creating the hyperlink destinations

Offsetting the hyperlink destinations

Updating the hero block spacing

Updating the mobile menu content and hyperlinks

Updating the menu colours

Adding the menu style-swapping effect

Uploading your project to GitHub

Working with your two HTML files

You will begin by working with two HTML files:

  1. In Visual Studio Code, from your websites/templates folder, open the following HTML file;   menus-template.html fa-icons-copy
  2. From your websites/portfolio/software folder, open the web page named index.html. fa-icons-copy

If you have any other files open in Visual Studio Code, you may wish to close them.

fa-icons-copy

This will help you to focus only on the two HTML files you will be working with.

Copying-and-pasting the menus HTML and JavaScript

Your next step is to copy content from the menus template file into your index.html web page.

  1. In the menus-template.html file, select and copy the menus-related HTML blocks. fa-icons-copy
  2. In your index.html web page, click just after the start of the opening <body> tag, and press the ENTER key a few times to open up some new lines of blank space.
  3. Paste the copied HTML for the menus.
  4. Switch back to the menus-template.html file, and select and copy the JavaScript code for the menus. fa-icons-copy
  5. In your index.html web page, scroll down to near the end of the web page, to just before the closing </body> tag.
  6. Press the ENTER key a few times to open up some new lines of blank space.
  7. Paste the copied JavaScript code for the menus.
  8. When finished, save your index.html web page.

You can close the menus-template.html file. You are now finished working with this template.

Updating the hero block spacing

Because of the ‘sticky’, menus that hide the upper 72px of the web page element follows them, you need to make a few changes to the spacing around and within the hero block at the top of your web page.

  1. In the style.css file, for desktop/laptop screens, increase the top padding value of the item-col-2 child columns as follows: fa-icons-copy
  2. And for mobile screens, edit the padding values as follows: fa-icons-copy
  3. Save the style.css file.

In your web browser, the web page should look as shown below.

fa-icons-copy

Updating the mobile menu content and links

In the lower part of the mobile menu, under the <hr> horizontal rule line, you can include some text about yourself, an image and some hyperlinks.

  1. If you wish to include a profile picture, the link to the placeholder image is as follows.
    <img src="assets/img/profile-pic.jpg" alt="Mary Smith, Web Designer"> 
    
  2. If you wish to include an email address or social media hyperlinks, replace the template-provided details with your own. Delete any details in the template you do not want to include.
  3. If you want to link your website's Home page, the link should be as follows.
    <a href="../../index.html">Home</a>
    
  4. If you want to link your website's Portfolio page, the link should be as follows.
    <a href="../index.html">Portfolio</a>
    
  5. And if you want to link your website's Contact Form page, the link should be as follows.
    <a href="../../contact/index.html">Contact</a>
    
  6. Save your index.html web page.

In your web browser, the web page should look as shown below on mobile screens.

fa-icons-copy

Updating the menu colours

In the menus-template.html file you copied-and-pasted into your index.html web page, the CSS class of menu-light is assigned to the desktop and mobile menus. As a result:

Let’s replace this default colour of red with the green colour of #5ba745 used elsewhere in the web page.

  1. In the menus.css stylesheet, scroll to the top of the file.
  2. On the VS Code menu, click the Edit option and then click the Replace command.
  3. A new search-and-replace dialog box appears at the top-right of the Visual Studio Code screen. fa-icons-copy
  4. In the first field, enter red.
  5. In the second, enter #5ba745.
  6. Click the left icon for Replace. Do not click the right icon for Replace All.
  7. One by one, replace every occurrence of the colour red with #ff5000 in your stylesheet.   (If you choose the Replace All option, Visual Studio Code will replace the letters 'red' inside words such as 'centered' that may be written in comments.)
  8. Save the menus.css file.

In your web browser, the web page should look as shown below.

fa-icons-copy

Adding the menu style-swapping effect

Your final step is to use some JavaScript code in the menus-template.html file you copied-and-pasted into your index.html web page to create the following effect:

To achieve this effect, follow these steps.

  1. In the index.html file, for the menu-related blocks below, replace the class of menu-light with the menu-dark class. fa-icons-copy
  2. Scroll down to near the bottom of the web page, and remove the // ‘comment‘ characters from the beginning of the JavaScript code as shown below. fa-icons-copy
  3. Inside the JavaScript style-swapping code, replace the class name of menu-transparent with menu-light as shown below. fa-icons-copy
  4. Save the style.css file.

In your web browser, the web page should look as shown below as you scroll down and back up the screen.

fa-icons-copy

When the user scrolls down the web page:

When the user scrolls back up the web page:

That’s it. You have now completed your ‘Software Analytics’ project.

You can display a finished version of the project web page by clicking the image below.

Web Design Project: Travel Agency 2n2l.com Brendan Munnelly

Uploading your project to GitHub

The final step is to upload your project to GitHub.

All the files you have updated for this project are in the software sub-folder of your websites/portfolio folder.

So the easiest option is simply to upload the entire software sub-folder to your account on GitHub.

  1. If you are not already signed in to your GitHub account, sign in now.
  2. On the left of your GitHub home page, click the name of the repository that holds your web pages.
  3. On the next GitHub screen displayed, click the portfolio folder. GitHub Upload
  4. GitHub should now display your portfolio folder. github-upload-portfolio
  5. With the portfolio folder displayed on your GitHub screen, click the Add file button and, from the dropdown list displayed, choose the option Upload files. Project Animation Google Fonts
  6. In File/Windows Explorer on your computer, display your portfolio folder and then drag-and-drop the software folder to the GitHub tab in your web browser. github-upload-drag-drop
  7. After uploading the software folder, scroll down to the bottom of the GitHub screen, enter a short message in the Commit changes box, click the Commit changes button, and wait for the upload to complete. github-upload-progress

Your updated ‘Software Analytics’ project web page is now 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/portfolio/software/index.html

or, simply:

https://username.github.io/portfolio/software

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



Return to Contents.