Exploring the Sidebar Navigation Features of Bootstrap 4

Looking to incorporate a vertical navigation menu on the left side of my webpage, extending the full height of the page.

My attempt to achieve this using the Bootstrap grid system resulted in the navigation menu becoming too wide. This issue persisted even when using only col-1 for the navigation sidebar.

Here is the desired layout for the navigation menu:

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

Answer №1

I was certain there was a solution for this, but it seems that I was mistaken (if you happened to find it, please do share).

I included two classes .col-sm-fixed which establishes the width to align with one column width, while also setting a max-width and min-width for better readability.

The second class is .flex-auto which configures the properties of the flex value so that regardless of size, the item will expand to fill the space within the row. Additionally, I applied flex-nowrap (pulled from bootstrap) to the row to prevent any layout mishaps where the main content could be pushed out of view.

edit

I discovered the bootstrap equivalent of flex-auto, which is col.

link here

.col-sm-fixed {
  flex: 0 0 8.333%;
  max-width: 250px;
  min-width: 100px;
}

.flex-auto {
  flex: 1 1 50%;
  min-width: 50%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
  <div class="row flex-nowrap">
    <div class="col bg-info">
      <ul class="nav nav-pills flex-column">
        <li class="nav-item"><a class="nav-link active">Hi</a></li>
        <li class="nav-item"><a class="nav-link">Howdy</a></li>
      </ul>
    </div>
    <div class="col-11 pl-1 bg-warning">
      Main Content Here?
    </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

Is the tabindex feature malfunctioning for the submit button in an HTML form?

Hey there, I created the design like this. However, the submit Tabindex is not working as expected. Can you please take a look at it and let me know what might be causing this issue? <input id="id" type="text" value="" class="input" tabindex="1"/> ...

Tips for capturing the dx dy SVG attribute using CSS

Seeking advice on the most effective way to access the dx dy SVG attribute in CSS. If this is not feasible, what would be the best approach in JavaScript? ...

What is the best way to set up a clickable image without making the entire div clickable?

Is it possible to make just a specific image clickable within a div without making the entire div clickable? I have an image inside an anchor tag and a surrounding div that is clickable. The issue is that the entire space around the first image, .home, is ...

Leveraging the bootstrap library from the node_modules directory with the assistance of gulp (no reliance on bower

After exploring various resources, I have found that most of them either mention outdated tools like bower or suggest using webpack, which I am not yet familiar with. The projects I am currently working on rely on gulp, so I would like to stick with that f ...

Is it possible to disable the pointer event on the parent element only in CSS

Here's the structure I'm working with: <div class='offline'>some text <button class='delete'>Delete</button></div> I want to disable the div using pointer-events: none, but still keep the button activ ...

Is it possible to determine if a JavaScript/jQuery effect or plugin will function on iPhone and iPad without actually owning those devices?

Is there a way to ensure that a javascript/jquery effect or plugin that works well on all desktop browsers will also work on iPhone and iPad without actually owning those devices? Can I rely on testing it on the latest Safari for Windows to guarantee comp ...

JavaScript Animation of Text

I have a challenge where I want to animate text's opacity in JavaScript after the user presses enter. However, I am struggling to achieve this with my current code. I can provide all of my code for you to review and help me understand why the animatio ...

Styling Angular2 Material Dialog: the perfect fit

The Angular2 material team recently unveiled the MDDialog module at https://github.com/angular/material2/blob/master/src/lib/dialog/README.md I am interested in customizing the appearance of Angular2 material's dialog. Specifically, I want to adjust ...

The design problem arises from using jQuery to dynamically prepare the table body at runtime

The table row and data are not appearing in the correct format. Here is a link to the problem on Fiddle: http://jsfiddle.net/otc056L9/ Below is the HTML code: <table border="1" style="width: 100%" class="eventtable"> <thead style="color: b ...

Utilize MaterialUI Grid to define custom styles for the ::after pseudo-element

I came across a helpful article on Stack Overflow about Flex-box and how to align the last row to the grid. I'm interested in implementing it in my project: .grid::after { content: ""; flex: auto; } However, I'm not sure how to inc ...

Retrieve the value of data from the dataset

I'm facing an issue assigning a string value to a variable depending on a boolean variable. After trying the following code: [Vue warn]: Error in data(): "TypeError: Cannot read property 'check' of undefined" TypeError: Cannot read proper ...

Exploding particles on the HTML5 canvas

I've been working on a particle explosion effect, and while it's functional, I'm encountering some issues with rendering frames. When I trigger multiple explosions rapidly by clicking repeatedly, the animation starts to lag or stutter. Could ...

Using jQuery to insert PHP code into a <div> element

In our capstone project, I'm looking to implement a dropdown calendar feature. I initially attempted to use ajax within a dropdown Bootstrap 4, but encountered issues with collapsing. As an alternative, I am considering utilizing the include method. A ...

Creating an input field within a basic jQuery dialog box is not possible

Can anyone assist me in adding an input box to my dialog box? I am working with jquery-ui.js. Here is the code I currently have: $(document).on("click",".savebtn",function(). { var id = $(this).attr("id"); $.dialog({ ...

The variable in the HTML input value is not fully visible when filling out the HTML form

I am working with a Python Flask code where I have passed a dictionary to an HTML form. The table in the form correctly displays both keys and values, but when trying to populate a form field with the value from the dictionary, only the first word is displ ...

The VARCHAR data type in MySQL does not support the inclusion of any alphabetic characters

I am currently working on setting up a MySQL database table and need to insert some values into it using PHP from a webpage. I have managed to achieve this, but I am running into an issue where I can only insert integer values into the table. I have tried ...

Is there a way to use JQuery/AJAX to extract the selected values from all drop-down menus within a designated container?

With the help of JavaScript, I am dynamically creating dropdown lists under dvContainer. My goal is to retrieve the selected values of all select elements within that container. Below is the HTML code generated through JavaScript: <div id="dvContai ...

What is the reason for ng-submit not being prevented by a mandatory select field?

In an HTML5 form, when a select element is required and no option is selected, the appropriate styling for invalidation is applied. However, the ng-submit still allows the form to be submitted. Why does this occur and is there a way to prevent submission ...

Can CSS3 animations be executed sequentially for each child element?

Have you ever tried creating a CSS3 animation in HTML? You can check out an example here. <div class="parent"> <a href="#">First</a> <a href="#">Second</a> <a href="#">Third</a> </div> With the ...

Creating an Interactive Image Gallery with PHP

I need help merging my gallery template with my PHP code to display images fetched from a database. The gallery code is provided below: <body> <section class="gallery-block cards-gallery"> <div class="container&qu ...