Creating a modern and sleek full-screen layout using Bootstrap 4's DIV Navbar component

Hi there, I'm seeking assistance with setting up layouts. As a newcomer to front-end development, I have been tasked with creating a layout similar to the one shown in the linked image:

view desired layout

The navigation elements (NAV) in the image correspond to NAVBARs Bootstrap components.

I am facing an issue where I am trying to stretch the navbars and content div to the full height of the page. Whenever I apply the min-height: 100vh attribute to nav3, it results in unwanted scrolling bars. My suspicion is that this attribute takes the height of the entire window and I may need to subtract the height of nav2. Hoping for a straightforward solution to this problem.

#dashboardContainer {
  display: flex;
  align-items: stretch;
}

#dashboardNav {
  height: 84px;
  width: 100%;
}

#rightBar {
  width: 376px;
}

#content {
  width: 100%;
  min-height: 100vh;
  transition: all 0.3s;
}

#sidebar {
  min-width: 175px;
  max-width: 175px;
}
<body class="dashboardBody">

  <div id="dashboardContainer">

    <nav id="sidebar">
      <!-- Left expandable sidebar  -->
    </nav>


    <div class="d-flex flex-column" id="content">
      <nav class="navbar navbar-expand-lg navbar-light p-0 justify-content-end" id="dashboardNav">
        <!-- Top navbar  -->
      </nav>
      <div>
        <div>
          <!-- Content  -->
        </div>

        <nav id="rightBar">
          <!-- Right sidebar  -->
        </nav>
      </div>
    </div>
  </div>

Answer №1

Kindly review my html and css meticulously.

I trust that it will be beneficial for you. :)

If you have any inquiries, feel free to ask.

 #dashboardContainer {
  display: flex;
  align-items: stretch;
}

#dashboardNav {
  height: 84px;
  width: 100%;
  background: #4154da;
}

#rightBar {
  width: 376px;
}

#content {
  width: 100%;
  min-height: 100vh;
  transition: all 0.3s;
}

#sidebar {
  min-width: 175px;
  max-width: 175px;
  background: #de3232;
}
nav#rightBar {
  width: 20%;
    flex-basis: 20%;
    background: #dec514;
    max-width: 175px;
}
.body-content {
    height: calc(100vh - 84px);
    width: 100%;
    flex-basis: 80%;
}
.dashboard {
    display: flex;
    justify-content: space-between;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">

<body class="dashboardBody">

    <div id="dashboardContainer">
  
      <nav id="sidebar">
        <!-- Left expandable sidebar  -->
        <h2>sidebar</h2>
      </nav>
  
  
      <div class="d-flex flex-column" id="content">
        <nav class="navbar navbar-expand-lg navbar-light p-0 justify-content-end" id="dashboardNav">
            <h2>Top navbar</h2>
        </nav>
        <div class="dashboard">
          <div class="body-content">
            <!-- Content  -->
            <h2>Body content</h2>
          </div>
  
          <nav id="rightBar">
            <!-- Right sidebar  -->
            <h2>Right sidebar</h2>
          </nav>
        </div>
      </div>
    </div>

Answer №2

Check out this code snippet for a dashboard layout. Feel free to make any necessary adjustments.

.dashboardContainer {
  display: flex;
  align-items: stretch;
  height: 100vh;
}

.dashboard-content {
  width: 100%;
}

#dashboardNav {
  height: 84px;
  width: 100%;
  background: purple;
  display: flex;
  justify-content: center;
}

.dashboard-wrap-content {
  display: flex;
  height: calc(100% - 84px)
}

.dashboard-left {
  width: 80%;
}

.rightBar {
  width: 20%;
  background: yellow;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.navbar h4{
  text-align: center;
}
#content {
  width: 100%;
  min-height: 100vh;
  transition: all 0.3s;
}

#sidebar {
  min-width: 100px;
  max-width: 100px;
  background: red;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dashboard-left {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

h4 {
  font-weight: bold;
  background: #fff;
  margin-bottom:0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />

<body class="dashboardBody">

  <div class="dashboardContainer">

    <nav id="sidebar">
      <!-- Left expandable sidebar  -->
      <h4>NAV1</h4>
    </nav>


    <div class="dashboard-content">
      <nav class="navbar navbar-expand-lg navbar-light p-0" id="dashboardNav">
        <h4>NAV2</h4>
      </nav>
      <div class="dashboard-wrap-content">
        <div class="dashboard-left">
          <!-- Content  -->
          Content
        </div>

        <nav class="rightBar">
          <!-- Right sidebar  -->
          <h4>NAV3</h4>
        </nav>
      </div>
    </div>
  </div>

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

Error: TweenLite has not been recognized

/justincavery/pen/mPJadb - this is a link to CodePen After copying the code from CodePen and running it, I encountered an error: "Uncaught ReferenceError: TweenLite is not defined". The image only draws once and there is no animation unless I press "F5 ...

Remove and modify an li element that has been dynamically generated within a ul list

Currently, I am facing an issue in my code. I am dynamically creating li elements by taking input from an input box and then appending the data within li tags using jQuery. However, after adding the li element, I have included a delete button. The problem ...

Safari's iOS appears to be causing a striped effect on Bootstrap fonts

I have developed a straightforward application utilizing Bootstrap version 3.3.5 and included a button with a dropdown feature: <!-- Large button group --> <div class="btn-group"> <button class="btn btn-default btn-lg dropdown-toggle" typ ...

Preserve page configurations upon page refresh

I'm currently in the process of creating a 'user settings' form. Each list item represents a different section, such as Updating username, Updating email, and Changing password. It looks something like this: <li> <header>Ti ...

Arrange pictures and hyperlinks on an image

I am trying to add links to an image, similar to what Wikipedia does with the map of Germany and its states. Back in the 90s, I would have used the map tag for this purpose. After examining the source code of the map on Wikipedia, I noticed that all the s ...

Creating an element in react-draggable with two sides bound and two sides open - here's how!

At the moment, I am facing an issue where the element is restricted from moving outside of the container with the class of card-width-height. My goal is to have the right and bottom sides bounded within the container while allowing the element to move beyo ...

Tips on ensuring a div covers the entire page even when a scrollbar is present

<div id="outer_product_wrapper" style="display: none;"> <div id="outer_inner_product_wrapper"> <div id="inner_product_wrapper"> Test </div> </div> </div> I&apo ...

Is there a way to customize this JQuery and HTML code to be specific to each row?

https://i.sstatic.net/RwuMl.pngIn CB UserList, each row in the form appears multiple times representing different records. The below code is intended to display a submit button and modules for show/hide functionality separately for each record on the list. ...

Display a particular div when a specific image is present within another div

I'm currently working on a task, but I'm having trouble with it. If I have an image called smiley.png within a div with the class "selected." <div class="selected" style=""><img width="25" height="24" src="images/smileys/smiley.png ...

Are there methods to individually style components that have been generated through the .map() function?

My goal is to style each <Tuner /> component separately, which are being rendered for each item in the this.state.notes array using this.state.notes.map(). I want to position them individually on the page, but currently they all appear together. This ...

Mozilla Firefox is having trouble rendering HTML elements

While a webpage loads perfectly in Chrome, it seems to be causing some issues in Firefox. Can someone please shed some light on what the problem might be and suggest a solution? Please visit this Link in both Chrome and Firefox to see the difference. Chr ...

JavaScript can be used to select and click on a specific li element using the :

I'm attempting to click on a specific link using a submit button. Essentially, I have a ul containing a large number of li elements, each with a link of class "episodeLink" inside, as shown on . I've added an input box where you can enter a num ...

Using a background image in CSS for horizontal rules can override other styling rules

Encountered an unusual CSS bug: After using background-image to style hr, none of the subsequent rules or selectors are displaying on the page: hr { border: 0; height: 1px; background-image: -webkit-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0 ...

Input field for postal code containing only numbers (maximum 5 digits) in Angular version 4/5

I am struggling with creating an input field that accepts numbers. If I use type="text", I can only type 5 characters of alphanumeric data, but if I use type="number", it allows any number input without limiting it to just 5 numbers. Thank you in advance f ...

Stylish date picker in CSS

Here is a design mockup along with my current solution. The issue arises when two numbers are adjacent to each other (either horizontally or vertically) as they should merge, illustrated in the mockup below. For example, when selecting numbers 48-49-50, t ...

HTML and JavaScript code to desaturate or grayscale image rollovers without the need for additional image duplicates or sprites

Is there a way to achieve grayscale to color image rollover effects without duplicating images or using sprites? I'm looking for an alternative technique that can accomplish this. Any suggestions on how to implement it? ...

What is the best way to retrieve the current date and time in PHP?

How do I get the date and time similar to 05-17-05 at 02:33:15 Can you please assist me in writing this in php? Can I use at with the date function in php? ...

Creating a Date Computation Tool that Adds Additional Days to a Given Date

I have a challenge where Date 0 represents the start date, Date 1 is the result date after adding a certain number of days (NDays). I am looking for help in JavaScript to calculate Date0 + NDays = Date1. Please assist me as my coding knowledge is quite l ...

Tips for maintaining the chat scroll position while typing on mobile devices

Check out this example page: https://codesandbox.io/s/summer-flower-uxw47?file=/index.html:4175-4223 The issue at hand is that when accessing the site from a mobile device and tapping on the input field, the keyboard pops up. This causes the text in the m ...

I am interested in implementing a feature that restricts a particular website from being accessed more than once every 24-hour period by

I'm looking to restrict user access to a webpage to once every 24 hours. Are there any solutions besides using cookies? I could use some guidance on how to implement this. Thank you in advance for your help. ...