If you need a layout that responds well to different screen sizes, consider using Bootstrap's responsive layout feature: https://getbootstrap.com/docs/4.0/layout/overview/
For your specific case, you can display a sidebar on large devices and hide it on smaller ones like this:
<div class='yourLargeNavbar'> ... </div>
<div class='yourSmallNavbar'> ... </div>
Then, with CSS styling, you can control the visibility of these elements based on screen width:
// For small devices (less than 768px)
@media (max-width: 767.98px) {
.yourLargeNavbar{
display:none;
}
.yourSmallNavbar{
display:block;
}
}
@media (min-width: 767.98px) {
.yourLargeNavbar{
display:block;
}
.yourSmallNavbar{
display:none;
}
}
This setup ensures that the appropriate navbar is shown based on the screen size.
Bootstrap provides examples and components, such as the navbar
component, that are designed to be responsive: https://getbootstrap.com/docs/4.0/components/navbar/
Update: Make sure to check and modify the code snippet provided in the post for better functionality.
You may also refer to this link for a working example: https://codepen.io/jpaulet/pen/xxEprGB