What could be causing my col-x to not function correctly in Bootstrap?

I am trying to modify my Bootstrap navbar by adding a Login button, but I encountered an issue. When I use col-x classes inside the navbar to separate elements equally, they only cover 50% of the width and no more. However, using col-x classes outside the navbar works as expected.

Here is the code snippet:

<!-- Navigation -->

    <nav class="navbar navbar-dark navbar-expand-md bg-blue sticky-top">
      <div class="container-fluid">
        <div class="row">
          <div class="col-4">
          <a class="navbar-brand" href="#">
            <h1 class="display-3">Petitions</h1>
          </a>
          </div>
          <div class="col-4">
            <button type="button" class="btn btn-primary btn-lg">
                Get Started
            </button>
          </div>
          <div class="col-4"> 
            <button
            class="navbar-toggler"
            type="button"
            data-toggle="collapse"
            data-target="#navbarResponsive"
          >
            <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="#">Home</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Company Mission</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">About Us</a>
              </li>
            </ul>
          </div></div>
        </div>
      </div>
    </nav>
 <!-- Navigation -->

Answer №1

I believe you are looking to create something similar to this:

https://i.sstatic.net/QRZdt.jpg

<nav class="navbar navbar-dark navbar-expand-md sticky-top" style="background-color: #000000;">
  <div class="container-fluid">
    <div class="row" style="width: 100%; margin-left: 0px; margin-right: 0px;">
      <div class="col-4">
      <a class="navbar-brand" href="#">
        <h1 class="display-3">Petitions</h1>
      </a>
      </div>
      <div class="col-4">
        <button type="button" class="btn btn-primary btn-lg">
            Get Started
        </button>
      </div>
      <div class="col-4"> 
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive">
        <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="#">Home</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">Company Mission</a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="#">About Company</a>
          </li>
        </ul>
      </div></div>
    </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

Why hasn't the string been properly encoded?

Consider the scenario below: string text = "this is an example of formatted \"string\""; When I display this as a plain string in my web API method: return Ok(text) it will output: this is an example of formatted "s ...

Bootstrap for Aligning Text Within Tables

I'm currently in the process of learning how to utilize bootstrap, and I've encountered a challenge. I have created a simple table, but the data for an order I generated is not aligning properly under its respective category. Can anyone offer ass ...

Bootstrap 4 Collapse - Ensuring that collapsed elements remain open when expanding other accordions

Can someone help me figure out how to keep an element open when another one is opened? Here is an example: https://getbootstrap.com/docs/4.0/components/collapse/ <div id="exampleAccordion" data-children=".item"> <div class="item"> & ...

Leveraging @extend in Webpack

Utilizing the bootstrap node package in my webpack configuration has been a smooth process. I have imported it alongside my other modules at the entry point app.js as shown below: import 'bootstrap'; import 'font-awesome-loader'; impor ...

The radio buttons are stuck and not changing their selection

Having a group of radio buttons with the same name, when one is checked, it automatically selects another one in the group. Here is my current code: <input name="a" type="radio"> <input name="a "type="radio" checked> JS $("input[type='r ...

obtain the string representation of the decimal HTML entity value

Similar Question: how to create iphone apps similar to ibeer, imilk, ibug, ibeer Using javascript to obtain raw html code Imagine having an html section like this: <div id="post_content"> <span>&#9654;<span> </div> ...

What's the name of the auto-triggered dropdown menu feature?

Visit Amazon's official website Description: Within the 'Shop by Department' section- A drop-down menu that remains visible without requiring you to hover over it. However, when the browser is in a non-full-screen mode, the menu disappears ...

Having trouble with the dropdown feature on AngularJs?

Encountering an issue while trying to display the dropdown list. Upon inspecting in Chrome, it seems like the data is loading correctly but when clicked, the dropdown menu does not show up. The data is fetched from the BooksController and all options are ...

Adjust the font size based on the dimensions of the container

I'm currently working on a script that dynamically sets the font-size based on the container's dimensions and the length of the text. This is what I have implemented so far. window.onload = function () { var defaultDimensions = 300; ...

Troubleshooting: Why is my JPG Image not displaying in React JS?

I've encountered an issue while trying to set a background image for a div. Some images display correctly, while others do not. I attempted various methods such as directly specifying the image path in the background-image property in CSS, importing ...

Adjust the content of an iframe based on the size of the screen

Hi there, I'm currently facing an issue with an ad that can't be resized. The support team suggested using two different ads - one for mobile and one for desktop. The dimensions of the ads are 720 x 90 and 300 x 100. I would like the ad to automa ...

The execution of the code may encounter errors initially, but it generally runs without any issues on subsequent attempts

I recently developed a piece of code to ascertain whether a value in the database is null or not. Here's the snippet: var table; var active = false; function CheckActive(table){ this.table = "table" + table + ""; var db = window.openDatabas ...

Can anyone suggest a method to customize the appearance of select options in Vue.js?

https://i.sstatic.net/qNov8.png Is there a way to customize the color and font of select options? I'm referencing this link for an example: . I attempted CSS modifications but they don't seem to be taking effect. ...

Removing outline from a Material UI button can be done using a breakpoint

Is there a way to remove the outlined variant for small, medium, and down breakpoints? I have attempted the following approach: const selectedVariant = theme.breakpoints.down('md') ? '' : 'outlined'; <Button name="buy ...

Maintaining Order with SCSS and Compass - Is it Possible?

Does compiled SCSS using Compass preserve the order of declarations? Can Compass guarantee the order of properties (assuming it's the way Compass operates that determines this)? This is mainly important when there are multiple definitions with the s ...

Z-Index Problem with PureCSS Horizontal Scrollable Menu

I've been working on this issue but can't seem to get it right. I have a purecss menu with a horizontal scrollable feature, but the submenus at depth 1 and 2 don't appear on hover in Firefox and Safari - they are being hidden underneath. I ...

Cross-domain scripting with JavaScript

I currently manage 2 subdomains securityservices.example.com workstations.example.com All workstations are associated with the workstations.example.com One of the workstations, known as WS789012 on the domain, is fully qualified as: WS789012.workst ...

Is there an issue with the padding not functioning correctly on smaller and medium-sized devices when using Bootstrap

On my desktop, I added '50px' padding to the body of my page and it's working properly. However, on smaller and medium screens, it's not functioning correctly. I tried using Bootstrap @media CSS functionality, but it still doesn't ...

Tips for placing the html <a> tag above an image and centered

Here's the HTML code I'm struggling with, which is inside an ASP.NET Repeater: <div class="team_member"> <a class="teamMemberLink" href='<%# "Profile.aspx?uID=" + Eval("ID") %>' target="_blank"><%# Eval("Name") ...

What is the best way to submit your CSS feature suggestions?

Is there a designated platform for submitting CSS feature requests officially? I am interested in proposing the addition of an 'inset' keyword to the text-shadow property for creating inset text shadows. This enhancement seems consistent with th ...