The alignment of buttons in the div row is not accurate

Here is the code snippet that I am working with:

<div class="row">
  <div class="col-md-2">
    <div class="dropdown">
      <button type="button" class="btn btn-bee-space-blue dropdown-toggle buttonWidth" data-toggle="drop down" aria-haspopup="true" aria-expanded="false">
        Generate Report <span class="caret"></span>
      </button>
      <ul class="dropdown-menu" role="menu" data-bind="foreach: { data: ReportExportTypes, as: 'exportType' }">
        <li>
          <a href="#" data-bind="reportExportTypeText: exportType, click: $root.OnGenerateReportClick.bind($root, exportType)"></a>
        </li>
      </ul>
      </br>
    </div>
  </div;

  <div class="col-md-offset-8 col-md-2">
    <button class="btn btn-bee-grey buttonWidth pull-right BackToScorecard" data-bind="click: $root.BackToScorecard, tooltip: { title: 'Back to Scorecard' }">Back to Scorecard</button>
  </div>
</div>

The above code renders correctly with alignment like this:

https://i.sstatic.net/5yNU6.png

However, when I introduce the following additional code snippet:

<div class="col-md-1">
  <button type="button" class="btn btn-bee-space-blue buttonWidth"  data-bind="click: EmailPopup, tooltip: { title: 'Get report to your email' },
    enable: ReportingEditEnabled"> Email Report</button>
</div>

This causes a misalignment of buttons as shown in the image:

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

Below is an updated version of the full code including the new button:

<div class="row">
  <div class="col-md-2">
    <div class="dropdown">
      <button type="button" class="btn btn-bee-space-blue dropdown-toggle buttonWidth" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        Generate Report <span class="caret"></span>
      </button>
      <ul class="dropdown-menu" role="menu" data-bind="foreach: { data: ReportExportTypes, as: 'exportType' }">
        <li><a href="#" data-bind="reportExportTypeText: exportType, click: $root.OnGenerateReportClick.bind($root, exportType)"></a></li>
      </ul>
      </br>
    </div>
  </div>

  <div class="col-md-1">
    <button type="button" class="btn btn-bee-space-blue buttonWidth"  data-bind="click: EmailPopup, tooltip: { title: 'Get report to your email' }, 
            enable: ReportingEditEnabled"> Email Report</button>
  </div>

  <div class="col-md-offset-8 col-md-2">
    <button class="btn btn-bee-grey buttonWidth pull-right BackToScorecard" data-bind="click: $root.BackToScorecard, tooltip: { title: 'Back to Scorecard' }">Back to Scorecard</button>
  </div>
</div>

I am trying to ensure that my Generate Report, Email Report and Back to scorecard buttons all appear in the same row.

Answer №1

Adjust the offset for the final button to 7. The concept behind this is that with a total of 12 columns in a row and using col-md-2 and col-md-1 for the buttons on the left, you are left with 9 columns till the end of the row. By making the last button 2 columns wide, there will be an offset of 7 columns between it and the other two buttons.

<div class="row">
  <div class="col-md-2">
    <div class="dropdown">
      <button type="button" class="btn btn-bee-space-blue dropdown-toggle buttonWidth" data-toggle="dropdown"
        aria-haspopup="true" aria-expanded="false">
        Generate Report <span class="caret"></span>
      </button>
      <ul class="dropdown-menu" role="menu" data-bind="foreach: { data: ReportExportTypes, as: 'exportType' }">
        <li><a href="#"
            data-bind="reportExportTypeText: exportType, click: $root.OnGenerateReportClick.bind($root, exportType)"></a>
        </li>
      </ul>
      </br>
    </div>
  </div>


  <div class="col-md-1">
    <button type="button" class="btn btn-bee-space-blue buttonWidth" data-bind="click: EmailPopup, tooltip: { title: 'Get report to your email' }, 
      enable: ReportingEditEnabled"> Email Report</button>
  </div>

  <div class="col-md-offset-7 col-md-2">
      <button class="btn btn-bee-grey buttonWidth pull-right BackToScorecard" data-bind="click: $root.BackToScorecard, tooltip: { title: 'Back to Scorecard' }">Back to Scorecard</button>
  </div>
</div>

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

Show information from an array

On the index.php page, there is a script that retrieves data from demo.php and presents the outcome in a div. <div class="leftbox"> <?php echo "<div id='proddisplay'>"; echo "</div>"; ?> </div&g ...

The media does not need to be applied to the ".nav__btn" class

How can I hide an element with the ".nav__btn" class by setting its display to none when the screen width is at least 768px? I tried the following media code but it doesn't work. Media Code @media (min-width: 768px) { .nav__btn { display: ...

Firebug displays the class name and location twice in the right panel

When examining a div labeled with .mlm-clearfix, I noticed that Firebug was displaying this class name and its URL twice in the right panel. The style declarations given for the Easy Clear Method in relation to this class are as follows: .mlm-clearfix:bef ...

Tips for customizing the appearance of an HTML5 progress bar using JQuery

Here is my method for obtaining the bar: let bar = $('#progressbar'); Styling and animating it is no problem, using either of these methods: bar.css(...) bar.animate(...) However, I am wondering how to adjust the CSS specifically for the prog ...

Prevent the clustering of advertisements using jQuery

Check out my code in action here! jQuery(document).ready(function(){ var insertionTemplate = jQuery(".hiddenAdBox").eq(0).html(), insertionTarget = jQuery('ul'), insertionTargetChildren = insertionTarget.find('li'), ...

Comparing jQuery's min-width and width properties: A guide on eliminating pixels

Exploring some basic jQuery and JavaScript here. When I use the .width() method, I get an integer value. However, when I use .css('min-width'), it returns a value in pixels which makes it challenging to perform calculations. What would be the be ...

I am encountering difficulties in successfully implementing the src tags for my JavaScript and CSS files

Currently, I am working on a sample web application using HTML5, Bootstrap, Express.js, Angular, and jQuery. I have been struggling with linking the js and css files in my project, as they only seem to work when hosted online. Below is an example of what m ...

Using jQuery to toggle an open and close button

My icon functions as an open/close button. When opened, it turns red and rotates 45 degrees. The issue arises when trying to close it. Changing the div class causes the icon to disappear while in its active state. Below is the jQuery code I am using: $(". ...

Place the div absolutely on top of the Flash content

Can a <div /> be absolutely positioned over a Flash banner without including wmode="transparent" in the banner? I am trying to display a lightbox above my ads, but I cannot make changes to the banners since they are provided by a third party. Edit: ...

Viewing the information stored in a text file hosted on a web server

I need help enhancing the functionality of a webpage on my server. Specifically, I want to display the contents of a text file saved on the server. I am struggling with the syntax, but it seems to involve using Flask along with HTML and JavaScript function ...

Calculating the computed width based on flex-basis at 0% and the flex-grow factor: what's the deal

Below is an example of HTML with default flex properties being used: <div class="container"> <div class="box"> BOX 1</div> <div class="box"> BOX 2</div> <div class="box box2"> BOX 3 .</div> </div> The ...

The Datatable feature is malfunctioning, unable to function properly with Javascript and JQuery

As a novice in the world of jquery/javascript, I find myself struggling with what may seem like an obvious issue. Despite following tutorials closely (the code for the problematic section can be found at jsfiddle.net/wqbd6qeL), I am unable to get it to wor ...

Full-screen mobile menu with sliding animation

I currently have a slide-out menu on my webpage, which is 350px wide let menuGeneral = $('#menu-general'); $('#menu-up-control').click(function () { menuGeneral.animate({ right: '0' }, 500); }); $(&a ...

Ways to alter the appearance of individual characters in the text input

My latest project involves dynamically changing the CSS styles of each individual character in a given text input. For example, if the user types "Stack" into the input field, I want the 'S' to appear in red, 't' in blue, 'a' ...

Is there a way to position my character at the exact center of my mouse click coordinates instead of the top left corner?

In my game, players can click on a 2D HTML5 canvas to set a point for their character to move to. However, I've noticed that when I click, the character appears in the lower right corner of where my mouse is clicked. After some research, I realized th ...

Is there a way to eliminate the number spinner in Angular specifically for certain input fields?

I am facing an issue where I need to remove the numeric spinner from only a few selected inputs. By adding the following code snippet to my styles.scss file, I was able to successfully remove the spinner: /* Chrome, Safari, Edge, Opera */ input[matinput]: ...

Fixing a CSS animation glitch when using JavaScript

I'm facing an unusual issue with my CSS/HTML Check out my code below: a:hover { color: deeppink; transition: all 0.2s ease-out } .logo { height: 300px; margin-top: -100px; transition: all 0.2s ease-in; transform: scale(1) } .logo:hover { transit ...

Stop IOS return button from triggering submission action

Having trouble with the IOS return key function on the keyboard (specifically in Safari on an iPhone). In my web application using Vue JS, I have a textarea within a chat component: <textarea class="field-text__input field-text__input--height-s ...

When you press the submit button, the screen automatically scrolls down but no action is taken

I'm currently utilizing Selenium WebDriver (Java) with the Firefox driver. Upon trying to click the 'Submit' button on a particular page, it only results in scrolling down the screen slightly. The button itself does not register the click, c ...

Tips for transferring an item from the server to the client side

After numerous attempts, I am still struggling to pass an Object from the backend to the HTML-Script for my Web App development. I have experimented with different methods but none seem to be working as expected. Backend function searchMain (allSeaVal) { ...