Menu

Log in

Sign up

From beginner to master of web design, coding, infrastructure operation, business development and marketing

  • COURSES
  • HTML & CSS Introduction
  • HTML & CSS Coding with AI
  • Linux Introduction
  • Docker Basics
  • Git & GitHub Introduction
  • JavaScript Coding with AI
  • Django Introduction
  • AWS Basics
  • Figma Introduction
  • SEO Tutorial for Beginners
  • SEO with AI
  • OTHERS
  • About
  • Terms of Service
  • Privacy Policy

© 2024 D-Libro. All Rights Reserved

HTML & CSS IntroductionChapter 17. CSS: Styling Components

Footer and Bottom Bar

Footer and Bottom Bar

Designing Footer and Bottom Bars in HTML & CSS

The footer and bottom bar are components placed at the end of each web page. When you implement the bottom bar, the bar is usually displayed at the bottom of the screen regardless of the scroll position.

In this lesson, we'll explain how to implement the fixed position bottom bar with a footer. For the bottom bar, we'll add buttons with links to the previous page and the next page.

This is the target design of the footer and bottom bar.

Footer and bottom bar UI example

In this case, we wrap the bottom bar with the footer tags. To create buttons, we use <a> tags with the classes already defined before in this chapter. As footer text, we set the course name. This is an example of HTML code.

HTML
<footer>
  <div class="btn-group">
    <a href="chapter16.html" class="btn-previous">←</a>
    <a href="chapter17.html" class="btn-next">→</a>
  </div>
  <p>HTML & CSS Introduction</p>
</footer>

Position: fixed and bottom: 0

To style the background of the footer area and footer text, add CSS code. To fix the position of the footer section at the bottom of the screen, set position: fixed and bottom: 0. We'll explain the position property in a more comprehensive way in the next course. You also need CSS code for buttons that have already been explained before. This is an example of CSS code.

CSS
footer{
  width: 100%;
  height: 50px;
  background-color: azure;
  margin: 0px;
  padding-top: 5px;
  text-align: center;
  position: fixed;
  bottom: 0;
}

footer p{
  color:#006e78;
  font-size:0.8rem;
  margin: 5px;
  padding:0;
}

.btn-group{
  display: flex;
  justify-content: center;
  list-style: none;
  gap: 5px;
}

.btn-previous{
  background-color:#2197A2;
  color: white;
  border-style: none;
  width: 60px;
  height: 25px;
  font-size: 1rem;
  font-family: roboto, sans-serif;
  border-radius: 25px 0px 0px 25px;
  text-decoration: none;
  text-align: center;
  line-height: 25px;
}

.btn-next{
  background-color:#2197A2;
  color: white;
  border-style: none;
  width: 60px;
  height: 25px;
  font-size: 1rem;
  font-family: roboto, sans-serif;
  border-radius: 0px 25px 25px 0px;
  text-decoration: none;
  text-align: center;
  line-height: 25px;
}

Practice

Objective:
Create and style a footer and bottom bar and fix the position at the bottom

1. Update the body section of the HTML file

Add the code below in the <body> section of the chapter17.html file.

As the footer section will be fixed at the bottom, the main content may be hidden under the footer section. To avoid this situation, add two line breaks (<br>) before the code for the footer section.

chapter17.html
<h2 style="text-align: center;">Footer</h2>
<p style="text-align: center;">See the bottom of this page</p>
<br>
<br>

<!--Footer-->
<footer>
  <div class="btn-group">
    <a href="chapter16.html" class="btn-previous">←</a>
    <a href="chapter18.html" class="btn-next">→</a>
  </div>
  <p>HTML & CSS Introduction</p>
</footer>
<!--End footer-->

2. Update the CSS code

Open the component.css and add new code to style the footer section and footer text.

component.css
/* Footer */
footer{
  width: 100%;
  height: 50px;
  background-color: azure;
  margin: 0px;
  padding-top: 5px;
  text-align: center;
  position: fixed;
  bottom: 0;
}

footer p{
  color:#006e78;
  font-size:0.8rem;
  margin: 5px;
  padding:0;
}

3. Check the result with a browser

Open chapter17.html with a browser. You can see that the bottom bar and footer text are displayed at the bottom regardless of the scroll position.

You can also check the sample result here (Demo Site).

link


You can also learn this topic offline. Click AmazonKindle.

More Topics to Explore

Completing Website Development from Start to Finish

Chapter 18. Completing Website Development

Enhancing Text with CSS text-decoration

text-decoration

What is HTML Document Structure and Why is it Important

HTML Document Structure

Choosing Font Colors in CSS

color

Completing Website Development from Start to Finish

Chapter 18. Completing Website Development

Enhancing Text with CSS text-decoration

text-decoration

What is HTML Document Structure and Why is it Important

HTML Document Structure

Choosing Font Colors in CSS

color

Tags:

Component

Footer

Navbar

Bottom Bar

HTML & CSS Introduction
Course Content

Chapter 1. Overview of Website Development

How Websites Work?

Designing, Building and Publishing Websites

Designing Websites

Building Websites – Frontend and Backend Coding

Web App vs. Website

Frontend Coding

Web Framework and CMS

Publishing Websites (Hosting Services)

Chapter 2. Preparing for Website Coding

Two Key Tools to Start Coding Websites

How Browsers Display Web Pages

File Name Rules

Website Directory Structure

Absolute Path vs. Relative Path

Chapter 3. HTML Basics

What Is HTML?

HTML Element

Attribute

HTML Document Structure

Layout Semantics

Heading and Paragraph Tag

Text-Level Semantics

Space, Line-break and Tag in Content

Comments in HTML Document

Chapter 4. HTML: Add Links and Images

Overview of Adding Links and Images

Embed Images – <img>

Image File Format

Add Hyperlinks – <a>

Add Hyperlinks to Images

Add Hyperlinks to Specific Location on Web Page

Link Tag – <link>

Script Tag – <script>

Chapter 5. HTML: Create Lists and Tables

Create Lists

Create Tables

Combine Table Cells

Chapter 6. HTML: Create Forms

Create Forms

Create Text Input Forms and Submit Button

Radio Button and Checkbox

Select Box

Labels

Auto Complete and Disabled

Chapter 7. Bridging HTML and CSS

Block Element vs. Inline Element

Nesting Elements – Parent Elements and Child Elements

Div vs. Span

Global Attribute – Class, ID and Style

Accordion – <Details> and <Summary>

Chapter 8. CSS Basics

What Is CSS?

CSS Syntax

Where To Type CSS?

CSS Basic Selectors

Descendant Selector

Inheritance

Specificity

Reset CSS

Browser Developer Tools for CSS

Comments in CSS Document

Chapter 9. Web Design Basics

Design Element Representation in HTML and CSS

Key Design Points by CSS

Length

Color Code – HEX and RGB

Color Theme

Chapter 10. CSS: Sizing and Spacing

CSS Box Model

width and height

padding

margin

Margin and Padding for Specific Side

margin: auto

box-sizing

Chapter 11. CSS: Styling Text and Images

Text Styling Properties

font-size

color

font-family

Web Font and Google Font

font-weight and font-style

text-decoration

line-height and letter-spacing

text-align

vertical-align

Styling Images

float: left and right

Chapter 12. CSS: Styling Backgrounds

background-color

background-image

background-size

background-repeat

background-position

background-attachment

background (Multiple Properties)

Chapter 13. CSS: Styling Borders and Drawing Lines

border-style

border-color

border-width

border-radius

Border (Multiple Properties)

Borders on Specific Side

Border Radius on Specific Side

Chapter 14. CSS: Layout – Key Concepts and Display Property

Layout Before and After

Layout Key Design Points

Display Property

inline, block and inline-block

display: none

Chapter 15. CSS: Layout – Flex Box

Flex Box – display: flex

flex-direction

Main Axis and Cross Axis

flex-wrap

justify-content

align-items

align-content

align-self

flex-grow

flex-shrink

flex-basis

margin: auto with Flex Box

Inline Flex Box

Nested Flex Box

Chapter 16. CSS: Styling Lists

List Styling Properties

list-style-type

list-style-image

list-style-position

Chapter 17. Creating and Styling Components

Components and Layout

Buttons

Cards

Top Bar

Footer and Bottom Bar

Chapter 18. Completing Website Development

Website Structure Design

Live Server

Home (Landing) Page Development

Main (List) Page Development

Content (Detail) Page Development

Chapter 19. Publishing Websites

Key Steps to Publish Websites

Domain and DNS Server

Favicon

GitHub Pages

Chapter 20. Supplemental Topics

Horizontal Rule – <hr>

Line Break – <br>

Reserved Characters and HTML Entities

Non-breaking Space – &nbsp;

Chapter 1. Overview of Website Development

How Websites Work?

Designing, Building and Publishing Websites

Designing Websites

Building Websites – Frontend and Backend Coding

Web App vs. Website

Frontend Coding

Web Framework and CMS

Publishing Websites (Hosting Services)

Chapter 2. Preparing for Website Coding

Two Key Tools to Start Coding Websites

How Browsers Display Web Pages

File Name Rules

Website Directory Structure

Absolute Path vs. Relative Path

Chapter 3. HTML Basics

What Is HTML?

HTML Element

Attribute

HTML Document Structure

Layout Semantics

Heading and Paragraph Tag

Text-Level Semantics

Space, Line-break and Tag in Content

Comments in HTML Document

Chapter 4. HTML: Add Links and Images

Overview of Adding Links and Images

Embed Images – <img>

Image File Format

Add Hyperlinks – <a>

Add Hyperlinks to Images

Add Hyperlinks to Specific Location on Web Page

Link Tag – <link>

Script Tag – <script>

Chapter 5. HTML: Create Lists and Tables

Create Lists

Create Tables

Combine Table Cells

Chapter 6. HTML: Create Forms

Create Forms

Create Text Input Forms and Submit Button

Radio Button and Checkbox

Select Box

Labels

Auto Complete and Disabled

Chapter 7. Bridging HTML and CSS

Block Element vs. Inline Element

Nesting Elements – Parent Elements and Child Elements

Div vs. Span

Global Attribute – Class, ID and Style

Accordion – <Details> and <Summary>

Chapter 8. CSS Basics

What Is CSS?

CSS Syntax

Where To Type CSS?

CSS Basic Selectors

Descendant Selector

Inheritance

Specificity

Reset CSS

Browser Developer Tools for CSS

Comments in CSS Document

Chapter 9. Web Design Basics

Design Element Representation in HTML and CSS

Key Design Points by CSS

Length

Color Code – HEX and RGB

Color Theme

Chapter 10. CSS: Sizing and Spacing

CSS Box Model

width and height

padding

margin

Margin and Padding for Specific Side

margin: auto

box-sizing

Chapter 11. CSS: Styling Text and Images

Text Styling Properties

font-size

color

font-family

Web Font and Google Font

font-weight and font-style

text-decoration

line-height and letter-spacing

text-align

vertical-align

Styling Images

float: left and right

Chapter 12. CSS: Styling Backgrounds

background-color

background-image

background-size

background-repeat

background-position

background-attachment

background (Multiple Properties)

Chapter 13. CSS: Styling Borders and Drawing Lines

border-style

border-color

border-width

border-radius

Border (Multiple Properties)

Borders on Specific Side

Border Radius on Specific Side

Chapter 14. CSS: Layout – Key Concepts and Display Property

Layout Before and After

Layout Key Design Points

Display Property

inline, block and inline-block

display: none

Chapter 15. CSS: Layout – Flex Box

Flex Box – display: flex

flex-direction

Main Axis and Cross Axis

flex-wrap

justify-content

align-items

align-content

align-self

flex-grow

flex-shrink

flex-basis

margin: auto with Flex Box

Inline Flex Box

Nested Flex Box

Chapter 16. CSS: Styling Lists

List Styling Properties

list-style-type

list-style-image

list-style-position

Chapter 17. Creating and Styling Components

Components and Layout

Buttons

Cards

Top Bar

Footer and Bottom Bar

Chapter 18. Completing Website Development

Website Structure Design

Live Server

Home (Landing) Page Development

Main (List) Page Development

Content (Detail) Page Development

Chapter 19. Publishing Websites

Key Steps to Publish Websites

Domain and DNS Server

Favicon

GitHub Pages

Chapter 20. Supplemental Topics

Horizontal Rule – <hr>

Line Break – <br>

Reserved Characters and HTML Entities

Non-breaking Space – &nbsp;