Combining a left vertical navigation bar with a top navigation bar in Bootstrap 4

I am currently working on creating an admin UI using bootstrap 4 that includes two menus, one vertical and the other at the top bar. My goal is to have a navigation layout similar to this:

https://i.sstatic.net/q2NbY.png

Here is the snippet of my HTML code for achieving this:

<div class="dashboard">
    <nav class="navbar navbar-expand-sm bg-white">
        <ul class="navbar-nav mr-auto">
        </ul>
        <ul class="navbar-nav">
            <li class="nav-item">
                <a href="#" class="nav-link">Test 1</a>
            </li>
            <li class="nav-item">
                <a href="#" class="nav-link">Test 2</a>
            </li>
            <li class="nav-item">
                <a href="#" class="nav-link">Test 3</a>
            </li>
            <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    Dropdown
                </a>
                <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
                    <a class="dropdown-item" href="#">Action</a>
                    <a class="dropdown-item" href="#">Another action</a>
                </div>
            </li>
        </ul>
    </nav>

    <div class="nits-nav-left-aside bg-white">
        <nav class="navbar navbar-light navbar-expand-sm px-0 flex-row flex-nowrap">
            <ul class="nav flex-sm-column flex-row">
                <li class="nav-item">
                    <a href="#" class="nav-link">Side 1</a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link">Side 2</a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link">Side 3</a>
                </li>
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="http://example.com" id="navbarDropdownSideMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        Side
                    </a>
                    <div class="dropdown-menu" aria-labelledby="navbarDropdownSideMenuLink">
                        <a class="dropdown-item" href="#">Action</a>
                        <a class="dropdown-item" href="#">Another action</a>
                    </div>
                </li>
            </ul>
        </nav>
    </div>
</div>

In order to style the layout as intended, I'm utilizing the following CSS properties:

.dashboard {
    color: #0a0302;
    height: 100%;
    background-color: #EAEDED;
 }

 nav {
    vertical-align: top;
    height: 70px;
    box-shadow: 0 4px 25px rgba(0,0,0,.2);
 }

 .nits-nav-left-aside {
    top: 0;
    left: 0;
    position: absolute;
    padding: 0;
    width: 70px;
    height: 100%;
    z-index: 10;
  }

 .nits-nav-left-aside > nav > ul {
    top: 100px;
  } 

However, the rendered UI seems different from what was desired:

https://i.sstatic.net/n6sPD.png

You can view the expected layout at this link:

Any assistance in resolving this issue would be greatly appreciated.

Answer №1

You set a specific height of 70px for the nav element, causing an issue. Consider assigning heights to separate classes instead of nav.

Answer №2

Visit my awesome website: webawesome.000webhostapp.com

Afterwards, navigate to inspect>sources>webawesome You can explore my CSS, JavaScript, and HTML there.

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

Discrepancy in Angular Material Buttons with theme design

I recently installed Angular 10 along with Angular Materials using the command ng add @angular/material I opted for the custom theme: Purple/Green The next step was to add a Toolbar by simply copying and pasting code from Google's site. However, I a ...

Is it possible to retrieve a background-size value of 'auto' using jQuery, JavaScript, or CSS methods?

Just imagine background-size: 50% auto; If I desire to capture the "auto" value, is there a way for me to determine the new height or width? ...

How can I center a text element vertically within its parent div element?

After researching various solutions to align text within a div, I have found that many recommend using the vertical-align property. Despite trying this method, it does not seem to work for my specific case. .free { display: inline-block; -webkit-bor ...

What is the best way to change the value of an input element (with type='month') to a string format "yyyy-MM"?

Need help converting the input value (type: month) to the format "yyyy-MM". HTML code snippet: <input class="bg-success btn btn-dark" type="month" id="timeCheckTimeSheets" ng-model="month"> AngularJS snippet: $http({ url: url + $scope.p ...

Slide a floating container downward by one line

I am in search of a way to create a unique text effect resembling a "sidebox" within my writing. The goal is to have a note or heading positioned at the start of a paragraph, floating either to the left or right with some negative space surrounding it and ...

"Phone calls at the click of a button with Twilio

I need to create a webpage where users can click a button to make a call to our office phone number directly from their browser. The code runs without any errors in the debugger, but when I try clicking the button on the page, nothing happens. There are ...

What safety measures should be implemented when granting users permission to modify HTML and CSS on your site?

I'm really impressed by the customization options on Tumblr. Users can edit the HTML and CSS of their profiles, which is something I'd love to incorporate into my own site. However, I'm concerned about the security implications of allowing t ...

The PHP/MySQLi registration form is displaying a blank white page without any visible output or error messages

Hey everyone, I'm currently working on a simple registration form in PHP and no matter how many times I try to run it, all I get is a blank white page. There are no errors or outputs, just pure emptiness. I was hoping someone could shed some light on ...

Errors from jQuery validation are causing disruptions in my form's functionality

When jQuery validation error messages appear, they take up space and push other fields downwards. I want the error messages to adjust within the available space and not disrupt other fields or elements. Below is the jQuery validation code I'm currentl ...

Creating a React button animation with CSS vibes

When I click a button, I want a subtle sparkle to appear and disappear quickly, within half a second. I've thought about using a gif, but it requires a lot of manual artistic work to achieve the desired effect. Is there a way to utilize the Animatio ...

What is the best way to completely eliminate a div from a webpage

I've created a new div element using jQuery: $(document.body).append('<div id="test"></div>'); Then, I display a success message and remove the div after 10 seconds: $('test').html('SUCCESS!'); setT ...

Discovering the value of an HTML element node in the TinyMCE editor through the use of JavaScript or jQuery

Is there a way to retrieve the node name value using JavaScript or jQuery within the TinyMCE editor? Currently, I am only able to access the nodeName using the code snippet below: var ed = tinyMCE.activeEditor; var errorNode = ed.selection.getNode().node ...

Setting the distance between marks on a material-ui slider is a handy customization feature to

I have customized a material-ui slider with some custom CSS and it is contained within a div of small width, requiring overflowX. How can I maintain a 5px margin between each mark on the slider? Check out the demo here https://i.sstatic.net/bxiXE.png Th ...

Creating Uniform Columns in Bootstrap 4

Is it possible to make the columns stack on top of each other at widths less than 768px, instead of 991px in Bootstrap 4? <!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8& ...

The white-spaces in Quill JS do not retain their original formatting

I recently integrated Quill JS editor into my website. During testing, I noticed that any text inputted after a white space gets emitted when alerting the content. Below is the HTML code snippet: <div id="postCommentEditor" class="postCo ...

Pass various checkboxes data in an email using PHP and $_POST

I'm having trouble sending my checkbox values via my email form as it keeps returning as "None" every time. Any assistance would be greatly appreciated! Code snippet: <form method="post" name="sentMessage" id="contactForm" novalidate> ...

Is there a way to incorporate pseudo-dynamic css into my projects?

I'm struggling with managing custom colored elements on my website. For instance, I have a hundred navigation squares on the site, each with its own unique color. The only solution I can think of is creating separate CSS classes for each color, but t ...

Unable to render nested HTML tag in simple React.JS component

I'm currently working on setting up my first component. After following a tutorial, I tried implementing their code to create the component. The code does inject the first <div> into the HTML document, but the <h1> element is missing. In ...

Achieving consistent width for flex items in each row

Can I ensure that all flex items have the same width? Currently, my code looks like this: .video-container { background-color: blue; min-height: 90vh; display: flex; flex-wrap: wrap; } .video { flex: 1 0 25%; } <div class="video-contain ...

Ways to troubleshoot the vanishing of a bootstrap template from my Laravel project

After downloading a laravel project from a shared hosting, I attempted to edit it on my localhost. However, I encountered two errors when trying to access the home address localhost:8000/: Warning: require_once(C:\Users\Rafaa\Downloads\ ...