How can I stretch Button width to 100% when the bootstrap navbar is toggled?

I am looking for a way to toggle navigation buttons in order to occupy the entire width. Currently, the buttons do not fill all available space as shown in this example on jsfiddle: example in jsfiddle

Here is the code I am using:

    <div class="collapse navbar-collapse" id="navbar-collapse-1">
        <div class="btn-group navbar-btn">
          <button type="button" class="btn btn-default dropdown-toggle navbar-toggle" data-toggle="dropdown" aria-expanded="false">
            Categories <span class="caret"></span>
          </button>
          <ul class="dropdown-menu" role="menu">
            <li><a href="#">Cat 1</a></li>
            <li><a href="#">Cat 2</a></li>
          </ul>
          <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
            Filters <span class="caret"></span>
          </button>
          <ul class="dropdown-menu" role="menu">
            <li><a href="#">Filter 1</a></li>
            <li><a href="#">Filter 2</a></li>
          </ul>
        </div>        
        <div class="btn-group navbar-right navbar-btn" role="group" aria-label="">
          <button type="button" class="btn btn-default">
            <span class="glyphicon glyphicon-th" aria-hidden="true"></span>
          </button>
          <button type="button" class="btn btn-default">
            <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
          </button>
        </div>
        <form class="navbar-form navbar-right" role="search">
          <input type="text" class="form-control" placeholder="Search"> 
        </form>
      </div>

If anyone has a solution, I would greatly appreciate it!

Thank you!

Answer №1

After reviewing your existing code, consider incorporating the following custom CSS:

.navbar-btn,.navbar-btn .btn{
    width:100%;
}

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

Issue with Webkit for inline display of elements using jQuery following their concealment

Check out my website at: When you type in the text box, jQuery filters the results by hiding and showing them. Everything works smoothly on Firefox, but Chrome and Safari seem to have a strange bug. Even though the elements are displayed inline when inspe ...

Customizing the appearance of checkboxes in React Material-Table filtering feature

Is there a way to modify the style of checkboxes in filtering? For instance, if I wish to adjust the dimensions of the checkbox that appears for the Birth Place field, what steps should I take? https://i.stack.imgur.com/pZLqQ.png ...

Creating dynamic web applications with JQuery and AngularJS

After reviewing the AngularJS documentation https://docs.angularjs.org/api/ng/function/angular.element The documentation states: If jQuery is available, angular.element is an alias for the jQuery function. If jQuery is not available, angular.element d ...

Selecting a filter for an array of objects

I'm struggling to implement a search feature in my mat-select DropDown. The existing options I've found online aren't quite working for me due to the object array I am passing to the Dropdown. Any assistance or guidance on this matter would ...

What is the best way to transmit files through ajax?

I am looking to implement file uploads using AJAX. I have experimented with both dropzone and ajaxupload libraries, but unfortunately, neither of them seem to be functioning properly. As a result, I decided to try implementing it on my own. Below is the ...

Trigger an event once a script is called in an external HTML file loaded through Ajax

My webpage features an Ajax Loaded Div, within which a Jquery plugin loads my Google Spreadsheet. I am struggling to add event listeners to detect when the spreadsheet is fully loaded due to the unpredictable loading time and the limitations of listening f ...

Animation not fluid with ReactCSSTransitionGroup

Currently, I am in the process of developing an image carousel that showcases images moving smoothly from right to left. However, despite its functionality, there seems to be a slight jaggedness in the animation that I can't seem to resolve. Interesti ...

Issue with JQuery's parentsUntil method when using an element as a variable not producing the desired results

I'm having trouble with a specific coding issue that can be best illustrated through examples: For example, this code snippet works as expected: $(startContainer).parents().each(function(index, parentNode) { if (parentNode.isSameNode(commonConta ...

Breaking or wrapping lines in Visual Studio Code

While working in Visual Studio Code, I often encounter the issue of long lines extending beyond the screen edge instead of breaking and wrapping to the next line. This lack of text wrapping can be quite bothersome. I utilize a split-screen setup on my co ...

What steps can I take to modify this script in order to display one image on top of another?

I am working on a script that creates cross fades for images. However, I have some text images that I would like to appear as fading in on each image transition. This means that when the first image appears, it will pause, then the text image will fade i ...

Styling X and Y axis font color in charts using JavaFX 2.x CSS

Is there a way to change the font color of both X and Y axes? In my search through the css reference for fonts, I only found properties like font-size, font-style, and font-weight. font-size, font-style and font-weight I attempted to use -fx-font-color ...

The Twitter Bootstrap navbar dropdown is hidden behind the slider image

I am having an issue with my navbar built using Twitter Bootstrap 3.1.1. On iPhones and iPads, the dropdown menu is hiding behind the slider image. It is set to position absolute and has a z-index of 1000. Strangely, on desktop screens, everything works f ...

The function is being called repeatedly when invoking the ng-src attribute for an image

Here is something similar to this <img width="100" height="177" ng-show="{{fileName}}" ng-src="{{getPath(fileName) || '' }}" class="img-thumbnail" alt="test" onerror="this.src = $(this).attr('altSrc')"> Within the Controller, ...

Using jQuery Mobile to Recycle a Header and Navigation

I'm a beginner when it comes to jQuery Mobile and I'm struggling to grasp the concept of reusing headers and general navigation. Currently, I have a header with a menu button on the right. When the menu button is clicked, a popup shows up with l ...

What is the best way to extract the value from a text box that is being looped through using the post method in order to insert it into

I was working with the code below. Each textbox for attendance is looped a certain number of times, and I need to capture the value of each attendance when the form is submitted to insert the values into a database. <form method="post" action="insert. ...

Utilizing locally hosted JavaScript in an HTML document

Hi everyone, I am an extreme beginner in HTML and JavaScript so I would appreciate explanations to be as simple as possible. Despite reading various versions of this problem, I am still struggling to figure it out. Any help is greatly welcomed. My goal is ...

When the ESC key is pressed during a keyup event, the value of event.which is determined to be

On my ASP.Net master page, I've implemented this jQuery code: jQuery(document).keypress(function(event) { alert('keypress() called. e.which = ' + event.which); if (event.which == 27) { jQuery(this).trigger(&a ...

Creating a Cool Ghosting Effect with jQuery UI Drag and Drop

Can anyone help me achieve the "ghosting" effect in jQuery UI similar to Scriptaculous? I've managed to implement drag-and-drop functionality, but I can't seem to find an option for ghosting an item while it's being dragged. Currently, when ...

The AJAX request sends the <div> element instead of the <button> element

I'm puzzled as to why this ajax call is passing the div id instead of the button id that I intended. <?php while($info = mysqli_fetch_array($sql)) { echo "<tr> <th>" .$info[& ...

The Challenge of Implementing Jquery in Internet Explorer

Having troubles with Jquery in IE, the code is not working. Can anyone assist me? Please check this on IE and FF (or opera, safari, chrome), select a state, and you'll notice that clubs load but do not appear in IE while they show up in FF. Your hel ...