Lab Front-End Development II
Lab Front-End Development II
This worksheet covers the following topics to help you understand how to develop a front-end web
application
CSS is the acronym of "Cascading Style Sheets." CSS is used to design the webpage for better layouts so that
the user can feel comfortable with the Web page. This language contains coding elements and comprises
these "cascading style sheets," which are equally called CSS files (. CSS). For today's tutorial, we will be
focusing on creating our CSS style sheet for our web application.
Prerequisite
A. Complete Front-End Development I lab exercise
First, you have to complete the Front-End Development I lab exercise to complete this tutorial.
We created a corresponding CSS stylesheet for each HTML file in the previous lab exercise. In this lab
exercise, we will be implementing CSS styling to enhance the presentation of our web application,
including colors, layout, and fonts.
Open your restaurant.css file; let's try creating some styles to make our restaurant.html more presentable.
Start by creating a new style class: "restaurant-name" and styling it accordingly. We use the .class selector
to select elements with a specific class attribute.
Startup a Terminal within your Visual Studio Code and run the node server.js command. Navigate to
http://127.0.0.1:8080/restaurant.html to see that the restaurant names had been styled successfully!
Congratulations! You have successfully created your first CSS style and integrated it into HTML! You can
refer to https://www.w3schools.com/cssref/ to test out various CSS properties you could implement for
your project.
Part 2: Utilize responsive web design practices using CSS grid, flexbox, and media queries
Bootstrap is one of the most popular CSS frameworks for creating responsive web applications! Not only is
it free, but it is also open-source. It includes numerous HTML and CSS-based design templates for
typography, forms, buttons, tables, navigation, modals, image carousels, etc.
For this exercise, we will be importing Bootstrap 4 into our project and trying out the various CSS design
templates.
After downloading the files, copy the files into your project corresponding js and CSS folders. Your file
structure should look as follows:
B. Import Bootstrap Javascript and CSS files for each of the screen
We will be importing their corresponding .js and .css files for each HTML file, similar to how you import
your.css and .js files.
Repeat the steps above to import the corresponding bootstrap .css and .js files for each of the .html files in
your project
Now that we have successfully imported Boostrap 4 into our project, let us change our restaurant.html to
use the framework!
Open up restaurant.html, try adding a div with a container class and another div with a row class. We are
using the Bootstrap 4 grid layouts to style our restaurants into a single row!
After specifying the classes, let's test our web application to see if it is styled accordingly!
Startup a Terminal within your Visual Studio Code and run the node server.js command. Navigate to
http://127.0.0.1:8080/restaurant.html to see that the restaurant's div had been styled successfully!
Expected Result:
1) Navbar: https://www.w3schools.com/bootstrap4/bootstrap_navbar.asp
2) Forms: https://www.w3schools.com/bootstrap4/bootstrap_forms.asp
3) Tables: https://www.w3schools.com/bootstrap4/bootstrap_tables.asp
4) Carousel: https://www.w3schools.com/bootstrap4/bootstrap_carousel.asp
Part 3: Implement modals for a web application
Now that we have successfully imported Boostrap 4 into our project, let's look at implementing a modal
component for our web application. The modal component is a customized popup box displayed on the
current page.
Open up restaurant.html, create a basic modal by adding the following codes at the bottom of the html:
</div>
</div>
</div>