Mobile Bottom Navigation Bar HTML CSS

Mobile Bottom Navigation Bar HTML CSS
Code Snippet:Mobile Fixed Bottom Nav
Author: Cesar Hernández
Published: January 16, 2024
Last Updated: January 22, 2024
Downloads: 13,818
License: MIT
Edit Code online: View on CodePen
Read More

This HTML and CSS code snippet helps you to create a bottom fixed navigation for mobile view. It uses CSS position property with absolute value to set the navigation at the bottom of the screen. You can also use fixed value to make it sticky while scrolling page content.

How to Create Mobile Bottom Navigation in Bar HTML & CSS

1. In first step, load the Google fonts API into the head tag of your HTML document.

<link href="" rel="stylesheet"><link rel="stylesheet" href="">

2. Now, create the HTML structure for bottom navigation as follows:

<h1>Mobile Fixed Bottom Nav</h1>

<nav class="mobile-bottom-nav">
	<div class="mobile-bottom-nav__item mobile-bottom-nav__item--active">
		<div class="mobile-bottom-nav__item-content">
			<i class="material-icons">home</i>
	<div class="mobile-bottom-nav__item">		
		<div class="mobile-bottom-nav__item-content">
			<i class="material-icons">mail</i>
	<div class="mobile-bottom-nav__item">
		<div class="mobile-bottom-nav__item-content">
			<i class="material-icons">person</i>
	<div class="mobile-bottom-nav__item">
		<div class="mobile-bottom-nav__item-content">
			<i class="material-icons">phone</i>

3. Style the navigation using the following CSS styles:

body {
  padding: 10px;
  padding-bottom: 50px;

h1 {
  margin-bottom: 2000px;
/* For Demo only */
   position: relative;
   width: 360px !important;
   height: 720px;
   border: 2px solid #bbb;
/* end demo only */
.mobile-bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  will-change: transform;
  transform: translateZ(0);
  display: flex;
  height: 50px;
  box-shadow: 0 -2px 5px -2px #333;
  background-color: #fff;
.mobile-bottom-nav__item {
  flex-grow: 1;
  text-align: center;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
.mobile-bottom-nav__item--active {
  color: red;
.mobile-bottom-nav__item-content {
  display: flex;
  flex-direction: column;

4. Finally, add the following JavaScript function to make the link active when clicked.

var navItems = document.querySelectorAll(".mobile-bottom-nav__item");
navItems.forEach(function(e, i) {
	e.addEventListener("click", function(e) {
		navItems.forEach(function(e2, i2) {

That’s all! hopefully, you have successfully created mobile bottom navigation bar using HTML and CSS. If you have any questions or suggestions, feel free to comment below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link