How to Create Side Menu Bar By Using HTML, CSS & JS.

 

How to Create Side Menu Bar By Using HTML, CSS & JS.





This tutorial will guide you through Creating a Side Menu Bar By Using HTML, CSS & JS. Follow all the given step :

Step 1 : Create Index.html and add given html code on it.
Step 2 : Create style.css and add given css code on it.
Step 3 : Create index.js and add given JavaScript code on it.

HTML


HTML Code for Side Menu Bar.


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Menu</title>
  <link rel="stylesheet" href="menu.css">
</head>
<body>
      <div class="overlay" id="myNav">
        <a href="javascript:void(0)" class="closebtn"
        onclick="closeNav()">×</a>

        <div class="overlay-content">
          <a href="#">Home</a>
          <a href="#">About</a>
          <a href="#">Disclamer</a>
          <a href="#">Contact</a>
        </div>
      </div>

      <span class="btn" onclick="openNav()">☰ Menu</span>
    </body>
</html>
    


CSS


CSS Code for Side Menu Bar.

    
body{
    font-family: sans-serif;
}

.overlay{
    height: 0%;
    width: 100%;
    position: fixed;
    z-index: 1;
    top: 0;
    left: 0;
    background-color: rgb(0,0,0);
    background-color: rgba(0,0,0,0.9);
    overflow-y: hidden;
    transition: 0.5s;
}

.overlay-content{
    position: relative;
    top: 25%;
    width: 100%;
    text-align: center;
    margin-top: 30px;
}

.overlay a{
    padding: 8px;
    text-decoration: none;
    font-size: 25px;
    color: #818181;
    display: block;
    transition: 0.3s;
}

.overlay a:hover{
    color: #f1f1f1;
}

.overlay .closebtn{
    position: absolute;
    top: 20px;
    right: 45px;
    font-size: 50px;
}

.btn{
    font-size: 25px;
    cursor: pointer;
    width: 100px;
    margin-left: 45%;
}
    


JavaScript


JavaScript code for Side Menu Bar.

    
 function openNav() {
 document.getElementById("myNav").style.height = "100%";
 }
 function closeNav(){
 document.getElementById("myNav").style.height = "0%";
 }

    






What is HTML

HTML, or HyperText Markup Language, is the standard markup language used to create and design documents on the World Wide Web. It's essentially the backbone of web pages, providing the structure and content that web browsers interpret and display.

HTML consists of a series of elements, which are enclosed by tags to define their purpose and function on a webpage. These elements can include headings, paragraphs, images, links, lists, forms, and more. By using a combination of HTML elements, web developers can organize and present information in a structured and visually appealing manner.

HTML is not a programming language but rather a markup language. This means it doesn't have the capability to perform calculations or execute complex logic like programming languages do. Instead, HTML focuses on describing the structure and content of a document, leaving the presentation and functionality to other technologies like CSS (Cascading Style Sheets) for styling and JavaScript for interactivity.

In summary, HTML serves as the foundation for building web pages, providing the structure and content necessary for browsers to render and display information to users on the internet.

What is CSS

CSS, or Cascading Style Sheets, is a language used to style the presentation of web documents written in HTML and XML. It provides a way to control the layout, colors, fonts, and other visual aspects of a webpage, enabling developers to create attractive and responsive designs. By separating content from presentation, CSS promotes cleaner code, easier maintenance, and greater flexibility in website design. With CSS, developers can achieve consistent branding, improved user experience, and better accessibility across various devices and screen sizes.

What is JavaScript

JavaScript is a versatile programming language used for creating dynamic and interactive web content. It enables developers to manipulate HTML elements, respond to user actions, and build seamless web applications. With its extensive ecosystem of libraries and frameworks, JavaScript powers both client-side and server-side development, making it an essential tool for modern web development.