Transform my sidebar menu into buttons for mobile and smaller screens

As a newcomer to bootstrap, I've been experimenting with converting my sidebar into a button for smaller screen sizes.

I've managed to customize everything to fit my needs except for one thing. When the screen size is reduced (as on mobile devices), the sidebar disappears. What I really want is for the sidebar to still be accessible but through a button.

Here's the HTML and CSS code I'm currently using:

#side-bar {
  height: 100%;
  background-color: #333f4d;
  padding: 0 !important;
  font-weight: 600;
  color: #d7d9db;
  position: fixed;
  float: left;
}

#top-bar {
  background-color: #1f2730;
  padding-top: 15px;
  padding-bottom: 3px;
}

#top-bar:hover {
  background-color: #aaa;
  font-weight: 700;
}

.sidebarclr {
  background-color: #fafafa !important;
  margin-left: -14px;
}
#logo{
margin-left: 35px;
margin-bottom: 8px;
width:32px;
height:32px;
}
li img{
width:16px;
height:16px;
margin-right: 5px;
}
.list{
  text-decoration:none!important;
  padding-bottom: 15px;
      padding: 10px;

  }
#sidebl > li a{
color:#d7d9db !important;

}
  
#sidebl >li a:hover{
background-color:#aaa !important;
text-decoration:none !important;
}
#sidebl >li a:focus{
background-color:#aaa !important;
text-decoration:none !important;
}
#user{
    margin-right: 10px;
    margin-left: 10px;
    float: left;

}
.userc{
border-radius: 3px;
height:32px;
margin-top:170px;
}
.light{
color: #8f98a3 !important;
    font-weight: normal;
font-size:11px!important;



}
.username{
display:inline-block !important;
    line-height: 16px;
    float: left;
margin-left:5px;
}
.userc:hover{
background-color:#aaa;
text-decoration:none;
}
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<div class="col-sm-2" id="side-bar">

  <div id="top-bar">
    <a href="#" title="home page" target="_blank">

      <img id="logo" src="images/logo.png" alt="">

      <h2 class="title"> Maven Up</h2>
    </a>
  </div>
  <div>
    <ul class="nav" id="sidebl">

      <li class="list">
        <a href="Dashboard.html"><img src="images/icons/006-dashboard.png" alt=""> DashBoard</a>
      </li>
      <li class="list">
        <a href="Entries.html"><img src="images/icons/005-post-it.png" alt=""> Entries</a>
      </li>
      <li class="list">
        <a href="globals.html"><img src="images/icons/004-worlwide.png" alt=""> Globals</a>
      </li>
      <li class="list">
        <a href="Assets.html"><img src="images/icons/003-picture.png" alt="">Assets</a>
      </li>
      <li class="list">
        <a href="user.html"><img src="images/icons/002-users.png" alt=""> Users</a>
      </li>
      <li class="list">
        <a href="#"><img src="images/icons/001-settings.png" alt=""> Setting</a>
      </li>
    </ul>
  </div>

  <div class="userc">
    <div id="user"><img src="images/user.png" alt=""></div>
    <div class="username"> User
      <div class="light">admin</div>
    </div>
    <!---      Navigation Bar User         --->
    <ul class="nav navbar-nav">
      <li class="dropup">
        <a href="#" class="dropdown-toggle glyphpadingbot" data-toggle="dropdown"><span class="gaparowup glyphicon glyphicon-chevron-up"></span></a>
        <ul class="dropdown-menu">
          <li><a href="#">Account Settings</a></li>

          <li><a href="#">User stats </a></li>

        </ul>
      </li>
    </ul>
    <!---      Navigation Bar End         --->
  </div>
  <!---      userc class div end      --->



</div>
<!-- COL SM 2 END -->

Answer №1

Check out bootsnipp for a variety of examples on sidebars. Many can be easily adapted to have mobile-friendly versions that only display the button on smaller screens.

Another helpful resource could be this guide from bootstrapious, offering even more tutorials and tips for creating sidebars in Bootstrap.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Save image files as binary data within a Mongoose schema and then render the images in an HTML form

Utilizing Express, Node.js, and Mongodb to develop a webpage for uploading and displaying image files. The binary of the image is stored in Mongodb using a schema. Below is a snippet of code from index.js and db.js: var Post = mongoose.Schema({ image ...

obtaining data from an HTML input field

I'm struggling to retrieve the value from an HTML input element, and despite my own research, it seems like I have the correct syntax. However, I'm still unable to get it to work, leaving me confused. When I log the value to the console, it appe ...

Having difficulty in successfully transmitting a dictionary via AJAX (POST) to Python (Django views) resulting in an empty dictionary every time

When I include this script in the head of the HTML : <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> and then use a button to call a function: <div> ...

Converting Buffers to Binary with JavaScript Node.js

I've been working with Node.JS Buffers to send and receive packets, but I'm struggling to figure out how to convert these buffers into binary representation. I attempted the following code snippet, but it didn't yield the expected results co ...

Is history.pushState capable of more than just making an xhr request?

I've hit a roadblock in my current project. The issue I'm facing is getting a registration page to load. The XHR request is returning the output of the PHP code, which is causing problems. My goal is to have it load as a document rather than an ...

What steps should I take to verify that the most recent version of a static website is being shown?

As a user, I often find myself hitting 'F5' or clearing my cache to ensure I'm seeing the most up-to-date content on dynamic websites. However, I'm curious if there are any techniques from a web designer's perspective that can aut ...

Is there a way to adjust the saturation and desaturation of an image using CSS?

Issue Update After further testing, I have discovered that the desaturation effect is only functioning properly in Chrome. How can I adjust it to work in other browsers such as FF and IE? (Title modified) Currently, I am working on turning a color image ...

Create an HTML component that expands to fill any leftover space on the page, without using flex

In my current situation, I have two elements positioned side by side with dynamic widths based on their content. The element on the right needs to fill up as much vertical space as possible without a set width. I am looking for an alternative to flexbox d ...

What advantages can be gained from having multiple package.json files within a single application?

Embarking on the journey of creating my inaugural full react web application entirely from scratch. Previously, I've mainly worked on assignments that were partially pre-made for me. While setting up my project, I couldn't help but notice that I ...

Options for configuring an HTML form

Experience our dynamic product slider in action! Visit this link to see it live. Get ready to enhance your website with this HTML Code: <link href="css/style.css" rel="stylesheet"> <script src="js/jquery.min.js"></script> <script sr ...

Retrieving a JavaScript variable from a Python Selenium request

Currently, I am utilizing Python in conjunction with Selenium to monitor changes on our pbx system. A specific value that I require is being retrieved through a JavaScript call and unfortunately, it is not directly written into the HTML code. This has made ...

How to Center an Image using Bootstrap 5

I attempted to horizontally center an image by applying the class justify-content-center to the parent div, along with text-center. Although this method worked for text, the image remained aligned to the left instead of being centered. How can I correct t ...

Top recommendations for implementing private/authentication routes in NextJS 13

When working with routes affected by a user's authentication status in NextJS 13, what is the most effective approach? I have two specific scenarios that I'm unsure about implementing: What is the best method for redirecting an unauthenticated ...

What is the best way to establish communication between a server and client using sockets in Node.js?

Presently, I am in the process of developing a JavaScript application using AppJS. I'm encountering some difficulties understanding the communication between the client and server. Issue with Menu Bar and Socket Interaction The main challenge lies ...

Angular 6 provides a regular expression that specifically targets the removal of any characters that are not numbers and enforces the allowance of

I have tried various solutions to restrict input in an Angular material input box, but none seem to be effective for my specific case. I need the input field to only allow numbers and a decimal point. Any other characters should be automatically removed as ...

Axios failing to transmit cookie information, despite setting withCredentials to true

Exploring the capabilities of React and Express to handle requests while including cookies. The communication between client-side and server-side is successful, however, the cookies are not being transmitted. On the client-side: import axios from 'axi ...

Tips on creating a transition in React to showcase fresh HTML content depending on the recent state changes

I am completely new to React and recently completed a project called Random Quote Machine. The main objective was to have a method triggered inside React when the user clicks a button, changing the state value and re-rendering to display a new quote on the ...

Leveraging the power of the wildcard feature to execute a variety of scripts when running

Inside my package.json file, I currently have the following scripts block: "scripts": { "test": "node tests/*-test.js" } In the tests folder, I have files named a-test.js and b-test.js. This can be confirmed by using the command ls tests/*-test.js. ...

It is not possible for jQuery to modify the style of ul and li elements

$(document).ready(function(){ $(".menu").on('click', 'li', function () { $(this).css('background-color', '#000000'); }); }); </script> <ul class="menu"> <li onclick="window.location.href=&apos ...

Building Your Own Array Object in JavaScript

Yes, it may seem crazy at first glance, but let me clarify things a bit. When using Jquery, for instance $('div'), it returns an Array Collection similar to this: [div#container, div#header, div#logo]. The interesting part is that primitive Arra ...