Arranging the alignment of Bootstrap dropdown button alongside labels

When using bootstrap 3, I am attempting to create a row of labeled dropdown menus with a final query button. However, the buttons are currently aligned to the left of the labels due to the btn-toolbar CSS. Changing the btn-toolbar to float right results in a reversed order of the query button and choices, with the labels in the correct position on the right.

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

<div class="btn-toolbar row">

  <div class="btn-group">
    <label class="btn-label">Topic:</label>
    <button id="choose_topic_title" type="button" class="btn btn-default">Select</button>
    <button id="choose_topic" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
      <span class="caret"></span>
      <span class="sr-only">Toggle Dropdown</span>
    </button>
    <ul id="choose_topic_menu" class="dropdown-menu">
      <li><a href="#">all</a></li>
      <li><a href="#">weather</a></li>
      <li><a href="#">sports</a></li>
      <li><a href="#">business</a></li>
      <li><a href="#">news</a></li>
      <li><a href="#">arts</a></li>
      <li><a href="#">science</a></li>
    </ul>
  </div>
  <div class="btn-group">
    <label for="choose_lang_title" class="control-label">Language:</label>
    <button id="choose_lang_title" type="button" class="btn btn-default">Select</button>
    <button id="choose_lang" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
      <span class="caret"></span>
      <span class="sr-only">Toggle Dropdown</span>
    </button>
    <ul id="choose_lang_menu" class="dropdown-menu">
      <li><a href="#">en-us</a></li>
      <li><a href="#">es-us</a></li>
    </ul>
  </div>
  <div class="btn-group">
    <a href="#">
      <button id="query_data" type="button" class="btn btn-primary">Query</button>
    </a>
  </div>
</div>

Is there a straightforward way in Bootstrap to align a horizontal row of labeled dropdown menus?

To see an example illustrating the issue, check out this jsfiddle: https://jsfiddle.net/cgalles/nqmqka2e/4/

Answer №1

To adjust the alignment of your labels, you have the option to modify the float property or apply the pull-left class to the labels.

.btn-toolbar .btn-label {
  float: left;
}

View Demo on JSFIDDLE

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

Using Jquery to hide or show objects within a <div> when clicked

My goal is to create a webpage that displays three different contents based on which button is clicked. Below is the code for reference: I want the page to show three specific sections: A search bar only when the 'search' button is clicked, T ...

Achieving precise column alignment in Bootstrap 4

After searching extensively on Google and various websites, I am still struggling to find a solution for vertically aligning columns to be centered. Many sources I found mention aligning horizontally, but none seem to address the issue of vertical alignmen ...

Apply the CSS style specifically to the initial row in the table

Is there a way to target the first row of a table with a different tr class using CSS? <div id="right"> <table> <tbody> <tr class="head"> <td >Date</td><td>Info</td><td>More</td> </tr> ...

Quick way to include id="" and class="" attributes to HTML elements using Sublime Text 2

Is there a way to configure Sublime Text 2 where inputting a . (dot) automatically generates class=" " and adding a # (hash) creates id=" " while typing an HTML opening tag? ...

Tips for designing a CSS Grid that features a maximum width for the main content and a minimum width for the sidebar

I'm attempting to design a two-column CSS grid with a main content area that has a maximum width of 800px and a sidebar that has a minimum width of 200px: https://codepen.io/dash/pen/gOmXqGr The grid needs to be responsive: The yellow sidebar should ...

Setting the width of colspan elements can be challenging when other columns have dynamic widths

I am working with a table setup that includes various columns for data tracking: <table > <thead style="width: calc(100% - 15px); display: table; table-layout: fixed;"> <tr> <th colspan="3">& ...

What is the best way to position the <h:panelGrid> itself at a location other than the center?

Whenever I utilize this code snippet <h:panelGrid id="myGrid" columns="1" rendered="#{myBean.showResults}" width="50%" border="1" style="text-align: center;"> The panelGrid items will be centered HOWEVER, I desire to center the h:panelGrid it ...

Tips for avoiding a situation where a table row with colspan disrupts the natural sizing of other columns due to lengthy content

I am dealing with a simple html table where rows can be clicked to show or hide the row below them, which contains additional details for the row above. The "detail" row that is toggled on click has a colspan set so that one cell spans all columns in the ...

Enhance Your Website with Dynamic Navigation Animation

Seeking assistance with animating a navigation bar on and off the screen from the left side. The nav is not animating as expected using the latest version of jquery.min.js. The first step was to animate the nav upon clicking an object. View the current pro ...

Encountering a problem while attempting to save a scss file in Visual Studio Code

As a beginner in using sass, I decided to utilize the node-sass NPM package for compiling scss files into CSS format. Upon saving the file, I encountered the following error: { "status": 3, "message": "Internal Error: File to ...

"Implementing a fixed header and footer with a scrolling content area within a parent div that has a fixed position for

I'm seeking assistance with some CSS tasks. Specifically, I need to maintain the same functionality in responsive view when utilizing a fixed position in the parent div (Bootstrap 5 is in use). (the main focus of this project is on fullscreen view of ...

CSS - Resizing Images

I am experiencing an issue with the width of an image on my website. I want it to span 100% of the browser frame, but it is currently limited to only 1000px wide. Please take a look at: The image in question is located at the top of the page. Is there a ...

Nested divs with overlapping background images

How can I incorporate background images in nested divs? <div id="templatemo_content" style="padding: 30px 30px 0 0; background: #fff url(images/foot_bg.png) no-repeat 0 bottom; z-index:10"> This particular div displays a grey-colored background imag ...

Adjusting webpage background with JavaScript

I've been struggling with this for the past six hours and can't seem to get it right. I've checked out various solutions on Stack Overflow, but nothing seems to work. What am I missing here?!? My html5 page doesn't have a background an ...

Adjust the positioning of the navbar-brand to the right within bootstrap 4

Here is what I currently have: <nav class="navbar navbar-toggleable-md navbar-light bg-faded"> <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarS ...

Tips on halting the current animation and modifying styles upon hovering

Currently, I have a basic label featuring a contact number with a blinking animation. However, the animation is only a simple color transition at this time (see code below). I have managed to successfully pause the animation and revert the text back to it ...

I would like the dropdown menu to only appear on mobile devices

After creating a dropdown menu, I now want it to only appear in mobile view and not in other views. I believe this can be achieved using "visible-xs" or a similar method, but I am struggling with the coding. Below is my HTML code: <nav class="navb ...

Guide to leveraging clsx within nested components in React

I am currently using clsx within a React application and encountering an issue with how to utilize it when dealing with mappings and nested components. For instance: return ( <div> <button onClick={doSomething}>{isOpened ? <Component ...

Simultaneously scrolling left and fading in with jQuery

I've come across this code that works well in scrolling my divs to the left. However, I'm looking to add a fading effect while they are scrolling. Is there a way to achieve this? $('div#line1').delay(1000).show("slide", { direction: "r ...

The menu on Android gets cut off by the status bar

Seems like an easy fix, our menu is getting cut off by the status bar on certain Android devices as shown in this screenshot. Any suggestions on how to resolve this issue? Could it be related to z-index properties? https://i.sstatic.net/Jh5SZ.png ...