Arranging Nav Items in a Stack with Bootstrap 4

Struggling to create a unique navigation bar design with fixed elements on both the left and right sides. The challenge arises when scaling down to mobile, as the icons on the right end up stacking. Any suggestions on how to resolve this issue?

<div className="container">
  <nav role="navigation" class="navbar navbar-light bg-faded navbar-toggleable-sm">
    <button className="navbar-toggler mr-auto" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                <span className="navbar-toggler-icon" />
              </button>

    <a class="navbar-brand mx-auto" href="/">
                HOMF
              </a>

    <ul class="navbar-nav ml-auto">
      <li class="nav-item">
        <i class="fas fa-search" />
      </li>
      <li class="nav-item">
        <i class="fas fa-shopping-cart" />
      </li>
    </ul>

    <div className="collapse navbar-collapse" id="navbarSupportedContent">
      <ul className="navbar-nav ml-auto text-center">
        <li className="nav-item">
          <NavLink to="/" className="nav-link">
            MENS
          </NavLink>
        </li>
        <li className="nav-item">
          <NavLink to="/" className="nav-link">
            WOMENS
          </NavLink>
        </li>
        <li className="nav-item">
          <NavLink to="/" className="nav-link">
            KIDS
          </NavLink>
        </li>
      </ul>
    </div>

  </nav>
</div>

Answer №1

Instead of using navbar-nav with white-space:nowrap, consider replacing it with simply nav on the parent <ul> tag. This change will apply display:flex and flex-wrap:wrap properties to your ul element.

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

Retrieving content from a div element

I am using Beautiful Soup to extract a list from HTML attributes. g_info = soup.find_all("div", {"id":"details_readonly"}) print g_info ## this prints out all the contents of the div tag. y = re.compile(r'B00(.{7})',g_info) print y The extrac ...

Unable to display Polygon using ReactNativeMaps

Having trouble displaying the polygon correctly on my screen. I suspect it's due to receiving an array of objects from my API. This is the code snippet in question: <MapView.Polygon coordinates={poligonofinale} strokeColor="#000" fillColor= ...

The interaction between background-size: cover and background-position

I wanted to experiment with setting background-size: cover and testing out different background positions. Feel free to check out the live fiddle for a hands-on experience. HTML <div id="container"> </div> CSS #container { backgro ...

Returning a 404 Error stating "Invalid request to /api/users/register."

Encountering an issue with proxy connection - unable to determine the root cause despite verifying all routes. Not able to successfully register the user and store data in MongoDB. Seeking suggestions for resolution. Thank you. Attempting to send user reg ...

Configuring React on the client-side along with Express.js on the backend using Webpack 4

I have successfully configured React and webpack. Below is my webpack.config.js file: const HtmlWebPackPlugin = require('html-webpack-plugin'); const path = require('path'); module.exports = { entry: { index: './client/inde ...

Innovative JavaScript function

Seeking a solution for my JavaScript function that should only be executed when the browser screen width exceeds 1024px. if ($(window).width() > 1024) { An issue arises when a user initially loads the webpage on an 800px browser screen and then resize ...

What is the process for incorporating additional fields into Firebase?

I am looking to incorporate a fresh field similar to the example shown below, but I am unsure of how to proceed. In my previous attempt, I utilized a method called {merge: true}, yet encountered no success with resolving the issue at hand. Whenever I inp ...

Avoid using propTypes for props verification

Looking for a solution to handle multiple props on a button: interface buttonProps { secondary?: boolean; tertiary?: boolean; width?: number; children?: any; icon?: string; } If the button includes an icon without any children, how can ...

Sort the DOM elements in jQuery based on their CSS color property

Displayed on the page below is a list of usernames in a random order. I'm looking to sort them using jQuery in the following sequence: red blue green purple black This is my current progress: <script type="text/javascript"> $(function() { ...

As the browser window is resized, the gap between images widens while the images themselves decrease

Hey there, I'm encountering some trouble with the image links at the top of my page. As I resize the browser or change screen resolutions in media queries using percentages, the images are resizing accordingly. However, I'm noticing that as the i ...

Can a specific input value be applied or utilized in any way?

I have limited coding experience, so please forgive me if this is a simple question. I am curious if it is possible to create a feature on a website where user input is utilized elsewhere. Specifically, I am looking to have an input box where a user enter ...

Tips for customizing Bootstrap theme color schemes in a React/Redux application that has been bootstrapped

As a newcomer to REACT, I am facing an issue with changing the theme colors in my freshly bootstrapped react application. I have gone through some solutions suggested by others but none of them seem to work for me. My entry point looks like this: import ...

Tips for vertically aligning <p> and <div> elements without using the table-cell property

I am trying to align my text vertically in the middle using a ch-grid <div> (the circle color element). Is it possible to achieve this without specifying a display attribute for the <p> element? I plan to hide it by setting display:none initia ...

Learn how to dynamically update the URL path when a specific tab link is clicked

One challenge I'm facing on my website is with the tabbed navigation for sub sections. The current script checks the URL path and selects a specific tab from the subNav array if it exists. However, switching to another top-level page doesn't upda ...

Every time I attempt to run the npx command, I encounter an error that says: "Error: EPERM: operation not permitted

Struggling to install the create-guten-block package using the command npx create-guten-block my-block, but unfortunately, it's not working out for me. My current node version is 10.15.1 Npm version I'm on is 6.4.1 Encountering the error shown ...

What is the best way to eliminate all styles from an element with jQuery?

body{ font-family: Arial; } div{ color: red; margin: 20px; background: blue; font-size: 17px; } <div id="div1">this should be styled with a blue background, red text, and 17px Arial font</div> <div id ...

Enhancing the appearance of div content in Angular by utilizing local template variables and material elements

Within this particular implementation, I have utilized an md-sidenav component with a local template variable #sidenavsearchArea. <md-sidenav #sidenavSearchArea align="" mode="push" opened="false"> sidenav content here.. </md-siden ...

What is the best method to adjust the width of the <option> tag within the <select> tag using CSS?

<!DOCTYPE html> <html> <head> <title>Page Title</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="s ...

Creating a Bottom-Up Menu in React Native: A Step-By-Step Guide

Need help figuring out how to create a menu that pops up from the bottom when a button is clicked. Any advice on where to start? If you have any guidance or insights, they would be highly appreciated. ...

Removing Specific Items from a List in React: A Step-by-Step Guide

I have developed a basic ToDo List App. The functionality to display tasks from the input form is working correctly, but I am facing issues with deleting tasks when the Delete button is clicked. export class TaskList extends Component { constructor(pr ...