Your Travel Portfolio Project

Beginning your three-page website for a fictitious travel agency that showcases responsive multi-column layouts created with CSS flexbox.

Learning Goals

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

  • Create layouts with CSS flexbox that display as two, three or four columns on desktop/laptop screens and as two columns or a single column on mobiles.
  • Add gutters between columns.
  • Add background colours.
  • Display square images as circles.

Introduction

This three-page website for a fictitious travel agency showcases responsive multi-column layouts created with CSS flexbox.

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

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

Portfolio project folders and files

Your first step is to download the files you need for this project.

  1. Download the following compressed file to your computer:  travel.zip
  2. If a sub-folder named portfolio does not already exist inside your websites folder, create it now. Website Project: Smoothies
  3. Uncompress the ZIP file into your websites/portfolio sub-folder as shown below. Website Project: Smoothies

This will create a sub-folder named travel inside your portfolio folder.

Website Project: Smoothies

The folders, sub-folders and files for this ‘Travel’ project will be as shown below.

Website Project: Smoothies

Working with your project files

Now you can begin to work with the files you have downloaded.

  1. In Visual Studio Code, open the following downloaded files. The first three are web pages; the fourth is a stylesheet file:
    • index.html, destinations.html and about-us.html: You will find these in your main travel folder.
    • style.css: You will find this in the assets/css/ sub-folder of the travel folder.
Website Project: Smoothies

You may wish to close any other files you may have open in VS Code.

The structure of your project web pages

Display the three project web pages in your web browser. They should look as shown below.

Note that all three web pages have a light grey background.

Website Project: Smoothies

Visual layout guides

To help you distinguish between the various parent and child elements, the following two styles are added at the bottom of the style.css stylesheet.

Website Project: Smoothies

Before and after each parent container is a set of three ‘blank’ or ‘spacer’ paragraphs. These are to help you see where one parent container ends and the next container starts.

Website Project: Smoothies

As with the coloured borders, you can remove these blank paragraphs at the end of the project.

Sub-dividing the web page with the <section> tag

As you can see, each of the three web pages is sub-divided into ‘blocks’ of content.

Website Project: Smoothies

You could use the <div> ... </div> for this purpose.

But a better, more modern HTML5 way is to use another tag pair with the same effect: <section> ... </section>.

Hero blocks and the <header> tag

Each web page begins with a hero section that is styled with the <header> ... </header> tag pair.

Website Project: Smoothies

This is similar to the <div> ... </div> tag pair, but is the preferred HTML5 way of identifying the first, introductory content block of a webpage.

Section blocks and class names

Under the ‘hero’ section (styled with the container-hero-block class), the basic structure of the three web pages is as follows.

wireframe wireframe wireframe
  • All content is contained inside a series of parent containers with a class of flexbox-container.
  • On all three web pages, some content stretches the full width of both desktop/laptop and mobile screens. This full-width content is within a child column named item-col-1.
  • On the index.html and about-us.html pages, the parent containers have child columns (item-col-3) that display as three columns on desktop/laptop screens and as one or two columns on mobiles.
  • On the destinations.html page, the parent containers have child columns that display as four columns on desktop/laptop screens and as two columns (item-col-4-2) on mobiles.

Adding padding to the sections

Follow these steps to add spacing around the four inside edges (top, right, bottom and left) of the parent flexbox containers.

  1. In the style.css file, at around line 80, you can see two .container-flexbox selectors have been created.   The first is inside a media query for desktops and laptops. The second is inside a media query for mobile screens.
  2. Add the padding values below for the two .container-flexbox selectors. Website Project: Smoothies
  3. Save your style.css file.

In your web browser, view the web page on desktop/laptop and mobile size screens. It should look as shown below.

Website Project: Smoothies

Adding a background colour to the sections

In the style.css file, you can see a class named .bg-orange has been created to apply an orange background colour. It takes effect only when combined with the container-flexbox class.

Website Project: Smoothies

Let’s apply this bg-orange class to some of the parent flexbox containers in your web pages.

  1. In the index.html web page, add the class name of bg-orange to the parent container that has inside it a item-col-1 child column with the text “Special Offers“. Website Project: Smoothies Also, add the bg-orange class to the parent container with the three item-col-3 child items. Website Project: Smoothies
  2. Save the index.html web page. On desktop/laptop and mobile screens, it should look as shown below. Website Project: Smoothies
  3. Switch to the destinations.html web page.   Add the class name of bg-orange to the two parent containers with the .item-col-1 child column. The first container contains the text “Europe” and the second, “Australia.“ Website Project: Smoothies Also, add the bg-orange class name to the two parent containers with the child items of .item-col-4-2 for the locations of “Europe” and “Australia“. Website Project: Smoothies
  4. Save the destinations.html file. On desktop/laptop and mobile screens, it should look as shown below. Website Project: Smoothies
  5. For those parent containers with an orange background, the headings and paragraph text is difficult to read.   Add the following new selectors and style rules to your stylesheet to change the text to white where the background is orange. Website Project: Smoothies
  6. Save the style.css stylesheet.

On desktop/laptop and mobile screens, your web pages should now look as shown below.

Website Project: Smoothies

You have now finished working with the container-flexbox parent containers. All your remaining updates will be to the child columns inside the parent containers.

Styling the single-column layouts

On both desktop/laptop and mobile screens, parent containers with an item-col-1 child will always display as a single column. Let's add some padding to these child items.

  1. In your style.css stylesheet, add the following padding values for the .item-col-1 selector within all parent containers. Website Project: Smoothies
  2. Save the style.css file, and, in your web browser, view the effect on your web page. Website Project: Smoothies

Styling the three-column layouts

On desktop/laptop screens, the three-column layout has no gutter spacing between the child columns. Let’s change this.

  1. In the style.css stylesheet, within the desktop/laptop media query for the .item-col-3 selector, reduce the width from 33.33% to 30% as shown below. Website Project: Smoothies The remaining space of 10% will be added as a gutter between the child columns.   This applies only to desktop/laptop screens (768px or wider) and has no effect on mobile screens (767px or narrower).
  2. Add some vertical spacing under the .item-col-3 columns as follows. Website Project: Smoothies
  3. Save the style.css file, and, in your web browser, view the effect on your web page. Website Project: Smoothies

Styling the four-column layouts

In the destinations.html web page, three of the parent containers have child columns that display as four columns on desktops/laptops and as two columns on mobiles.

These child columns have a class of .item-col-4-2. At the moment, the .item-col-4-2 class has no gutter spacing between the child items. Let’s change this.

  1. In the style.css stylesheet, within the desktop/laptop media query for the .item-col-4-2 selector, reduce the width from 25% to 22% as shown below.   And within the mobile media query for the .item-col-4-2 selector, reduce the width from 50% to 47%.   Also, add the following vertical spacing under the child columns. Website Project: Smoothies
  2. Save the style.css file, and, in your web browser, view the effect on your web page. Website Project: Smoothies

Styling the customer testimonials section

On the about-us.html web page is a section named “Some customer testimonials”. The parent flexbox containers have a special class named happy-users. Let’s update the related style rules.

  1. In the style.css stylesheet, add a new CSS selector named .container-flexbox.happy-users .item-col-3.   Add style rules to center-align the content (text and images) within the .item-col-3 child items that have, as their parent, a container with the classes of container-flexbox and happy-users. Website Project: Smoothies
  2. Within the desktop/laptop media query, add some gutter spacing between the .item-col-3 child columns and some vertical spacing under them. Website Project: Smoothies
  3. Within the mobile media query, also add some gutter spacing between the .item-col-3 child columns and some vertical spacing under them. Website Project: Smoothies
  4. Lastly, add the following style properties and values for the images within the .item-col-3 child columns. Website Project: Smoothies These style rules will display the images as circles, and add a coloured border around them.
  5. Save the style.css file, and, in your web browser, view the effect on your web page. Website Project: Smoothies

Removing the visual layout guides

You can now delete the visual layout guides from your web pages and stylesheet.

  1. Within your web pages, delete the sets of three blank paragraphs before and after the parent flexbox containers. Website Project: Smoothies
  2. At the bottom of your style.css file, delete the styles for coloured borders around the parent containers and child columns. Website Project: Smoothies
  3. When finished, save your index.html, destinations.html, about-us.html and style.css files.

Click here to view a finished version of the travel agency website.

Uploading your files to GitHub

After finishing your web page and stylesheet, you are now ready to upload them to your account 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 ‘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, near the right of the screen, you can see a button named Add file. Click on it. github-upload-portfolio
  4. From the dropdown list displayed, choose the option Upload files. Project Animation Google Fonts
  5. In File Explorer (Windows 10) or Finder (Apple Mac), drag-and-drop your entire 📁 portfolio sub-folder to upload it to your repository on GitHub. Introduction to HTML
  6. 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.
  7. Finally, click the green Commit changes button to upload your files. Project Animation Google Fonts

Your portfolio project web page is now published on GitHub at a web address similar to the following:

https://username.github.io/portfolio/smoothies/index.html
or simply:
https://username.github.io/portfolio/smoothies

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