Responsive Bootstrap Navbar Alignment with 3 Columns

I'm seeking advice on how to enhance my portfolio with a simple addition. Specifically, I want to modify my NavBar in bootstrap to display in three columns, similar to the visual concept illustrated below.

https://i.sstatic.net/4XHRJ.png

Currently, I have the basic bootstrap NavBar implementation using default code:

<!-- Navigation -->
<nav class="navbar navbar-expand-lg bg-white fixed-top">
  <div class="container">

    <a class="nav-link" href="#">my name goes here</a>      

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse" id="navbarResponsive">
      <ul class="navbar-nav ml-auto">
        <li class="nav-item"><a class="nav-link" href="#">about</a></li>
        <li class="nav-item"><a class="nav-link" href="#">resume</a></li>
      </ul>
    </div>

  </div>
</nav>

I've managed to tweak the styling to achieve a somewhat acceptable layout through padding adjustments, but I seek a more elegant solution. My main challenge lies in understanding and implementing the responsive design, especially merging the links into dropdown navigation on mobile while maintaining consistency. Additionally, I aim to place 'my name goes here' as the header above the navigation on smaller screens.

Any guidance or tips would be greatly appreciated. Thank you.

UPDATE

<!-- Navigation -->
<nav class="navbar navbar-light navbar-expand-md bg-success justify-content-between">
<div class="container-fluid">
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".dual-nav">
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="navbar-collapse collapse dual-nav w-50 order-1 order-md-0">
        <ul class="navbar-nav">
            <li class="nav-item active">
                <a class="nav-link pl-0" href="#">work <span class="sr-only">work</span></a>
            </li>
        </ul>
    </div>
    <a href="/" class="navbar-brand mx-auto d-block text-center order-0 order-md-1 w-25">Colin Grant</a>
    <div class="navbar-collapse collapse dual-nav w-50 order-2">
        <ul class="nav navbar-nav ml-auto">
            <li class="nav-item"><a class="nav-link" href="">about</a></li>
            <li class="nav-item"><a class="nav-link" href="">resume</a></li>
        </ul>
    </div>
</div>

This revised structure seems to function appropriately. Any further suggestions for optimization?

Appreciate your input.

Answer №1

Here's my approach using Bootstrap 4 to create a responsive navbar. When the screen size is less than 992px, the right side of the navbar will collapse into a button.

<nav class="navbar navbar-expand-lg navbar-dark bg_color_primary sticky-top d-flex justify-content-between ">

    <div class="navbar-nav  col-4 align-items-start ">
        <div class="text-white bg_color_primary_light  rounded-circle p-2">
            Work
        </div>
    </div>

    <div class="col-4  d-flex justify-content-center">
        <a class="navbar-brand text-white brand_name   " href="">
            BrandName
        </a>
    </div>

    <button class="  navbar-toggler ml-auto  align-items-end" type="button" data-toggle="collapse"
            data-target="#navbarNavDropdown"
            aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse  col-4 " id="navbarNavDropdown">
        <div class="navbar-nav ml-auto ">
            <a class="nav-item nav-link" href="">About</a>
            <a class="nav-item nav-link" href="">Resume</a>
        </div>
    </div>

</nav>

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

Inner box shadow obscured by a sibling div

I am facing an issue with a div that has an inner box shadow being covered by another div. I have tried using position: relative, but it did not solve the problem. Here is an example: CODE EXAMPLE .example-div{ background:#fff; color:#000; ma ...

Design a circular text element using Tailwind CSS

Just starting out as a web developer and running into some issues with Tailwind CSS. Here's what I'm trying to achieve: https://ibb.co/KL8cDR2 This is the code I have right now: <div class="w-1/2 h-10 rounded-full bg-gray-400" style ...

Adjust the background color of a list item using Typescript

At the top of my page, there's a question followed by a list of answers and the option to add new ones. You can see an example in the image below. https://i.stack.imgur.com/NPVh7.jpg The format for each answer is "(username)'s response: at this ...

Outline a table element without altering the dimensions of the cell

When creating a diagram in an HTML table, I encountered a challenge. The TD elements have fixed dimensions, and I wanted to highlight this div with a border or circle. However, when I attempted to do so using CSS, it deformed the div. I couldn't use ...

Choppy Animation in Bootstrap 4 Collapsible Card Design

Creating a card using Bootstrap 4 with a .card-header and .card-block: <div class="card"> <div class="card-header"> <a data-toggle="collapse" href="#test-block" aria-expanded="true" aria-controls="test-block"> car ...

What could be causing an unidentified term to be included in the Vue SCSS compilation process

In my Vue application with TypeScript, I encountered an error during compilation that reads as follows: Failed to compile. ./src/style.scss (C:/../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!C:/.../node_modules/vue-loader/lib/loaders/stylePostL ...

How can I use jQuery to implement a progress bar for Iframes loading?

My job involves working on an intranet where I have a complex aspx page with multiple Iframes, all of which we control. Each iframe is dynamically set using JavaScript/jQuery by different buttons on the page. Some buttons set the src attribute for iframes ...

The color of text is being altered by IE 7's gradient filters

I'm facing an issue with the CSS code applied to a button (along with other styles): border: 1px solid #86A74B; border-top: 1px solid #B0C5B0; background-color: #91B248; background-image: -moz-linear-gradient(top, #9BBC52, #84A440); background-image: ...

Using document.createElement or HTML elements in JavaScript

I'm a bit confused about the different coding styles. I am interested in knowing which method is the most practical and efficient for inserting HTML tags into a document. One option is using JavaScript: document.getElementById('demoId').in ...

What is the method for modifying the chosen color using a select option tag instead of a list?

element, I have a Vue component that features images which change color upon clicking a list item associated with that color. <div class="product__machine-info__colors"> <ul> <li v-for="(color, index) in machine.content[0] ...

switch hover interactions to click

I'm looking to change from hover to mouse click, and here is a snippet of the code: HTML <li class="has-dropdown"> <a href="#">Click Me</a> <ul class="dropdown"> <li> ...

(Django) How can I show an image directly from my computer instead of it being retrieved from localhost?

I'm at my wit's end with this problem... I can't seem to get any images to show up on my website. I've experimented with absolute paths, relative paths, different folders, but nothing seems to do the trick... Here's the HTML code I ...

"Dragging and dropping may not always perfectly align with the position of the droppable div that is

When attempting to drag and drop three images into a droppable div, I encountered an issue where the images were not perfectly positioned within the div. This problem seemed to be related to the positioning of the droppable div itself. Specifically, when s ...

What is the method for showcasing background images sequentially?

css code #intro { position: relative; background-attachment: fixed; background-repeat: no-repeat; background-position: center top; -webkit-background-size: cover; -moz-background-size: cover; backgr ...

The fullscreen revolution slider in Wordpress is displaying a small white space below it

Check out my website at: . As I reduce the browser width, a blank space appears below the top revolution slider. I'm struggling to get rid of it. Here's what I've tried so far: .boxedWrap .fullScreenSlider {height: 100%;} .boxedWrap .fu ...

What is the method for altering the color of the webkit-slider-thumb using JavaScript?

I am looking to adjust the color of an input range using JavaScript instead of CSS. Can someone help me with this request? Current CSS Code: input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; background: goldenrod !importa ...

Is there a way I can inform iPhone users on my webpage about the existence of an app?

Hey there! I've managed to figure out how to detect the platform being used. It's working well so far: // Extract User-Agent String var UserAgent = navigator.userAgent.toLowerCase(); // Check User-Agent for certain keywords if (UserAgent.search ...

Switching between a secondary menu using ClassieJS or jQuery?

Currently, the code is configured to toggle the same menu for every icon. To see my current progress, you can check out this fiddle: http://jsfiddle.net/2Lyttauv/ My goal is to have a unique menu for each individual icon. I began by creating the followi ...

Tips on displaying two columns as a single column on mobile devices

Bootstrap 3 table is described as: <style> /* Overriding Bootstrap style to ensure description text wraps into multiple rows on mobile */ .details-propertyvalue { white-space:normal !important; } </style> <table class="table table-hove ...

What causes jquery to not trigger PHP when the HTML file resides in a different location?

In my project structure, I have a 'js' folder containing the jQuery function and a PHP script. The HTML file is located in a separate folder. Currently, the setup looks like this: /server/js/global.js /server/js/script.php /server/html/stude ...