Middle row positioning for button in Bootstrap 4 form-inline

My goal is to create a form with inline elements using Bootstrap 4. However, I'm facing an issue where the button always aligns at the top of the row instead of being in the middle like the input field. How can I ensure that the button's position matches the input field's position?

<form role="form"  id="form_tambah_kriteria" class="margin-bottom-0">
    <div class="form-row">
        <div class="form-group col-md-4">
            <label>Tipe Decision Maker</label>
            <div class="input-group">
                <div class="input-group-append"><span class="input-group-text"><i class="ion-ios-contacts"></i></span></div>
                <input type="text" name="tipe_dm[]" class="form-control" placeholder="Tipe Decision Maker">
            </div>
        </div>
        <div class="form-group col-md-4">
            <label>Owned by:</label>
            <div class="input-group">
                <select class="form-control" name="owner_dm">
                    <option value="">0</option>
                    <option value="1">1</option>
                    </select>
            </div>
        </div>
        <button class="btn btn-danger">Delete</button>
    </div>
</form>

You can view the code on Codepen

Answer №1

To resolve the issue, you can enclose the button in a form-group and precede it with some hidden text (&nbsp; or <br />). However, this is merely a temporary solution and does not address the underlying problem in your code.

A more effective solution would involve:

  • Utilizing the latest stable version of Bootstrap - your current pen uses v4.0.0-alpha5, which lacks bugfixes and flexbox classes.
  • Encasing the button within a .form-group.col-md-4
  • Applying the d-flex align-items-end classes to the .form-row

See a functional example here: https://codepen.io/andrei-gheorghiu/pen/KKKNxZg


Note that until you switch to the latest stable version of Bootstrap's CSS, you may continue encountering perplexing issues. The pre-release version you're using lacks many elements considered standard in most Bootstrap 4 examples.

Answer №2

To easily create a new line before the "Delete" button, simply add <br> before the button code. Here's how you can do it:

<br> <button class="btn btn-danger">Delete</button>

Answer №3

To properly place the button within the third column grid, make sure to include a line break tag <br /> in your code. Here's an example of how it should be done:

<div class="form-group col-md-4">
  <br />
  <button class="btn btn-danger">Delete</button>
</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

alignment problems in dropdown menus

I'm currently working with 3 bootstrap dropdown elements. The toggle for the first two is not controlled by jQuery, but for the third one, I am using jQuery to show and hide it. However, I've encountered some issues that need fixing. When clickin ...

Generating PDFs with multiple pages using android.graphics.pdf

Currently, I am facing an issue while attempting to generate a PDF using android.graphics.pdf. The problem arises when dealing with multiple pages in the document. While I can provide android.graphics.pdf with HTML content that could be converted into a PD ...

How can I use CSS to ensure that both cards and images are equal in size?

I am currently utilizing react, with Material-ui being used for the Cards. For the layout, I have implemented CSS Grid Layout for the Grid system. Presently, the structure looks like this: https://i.stack.imgur.com/0FDyY.png However, my desired outcome i ...

Are there any alternatives to using quotation marks and apostrophes in writing?

I have a line of PHP code that displays page numbers automatically generated based on the content in a table. All the page numbers have the same color, but I want to highlight the current active page. I tried using a condition within the class attribute, b ...

Issues persisting with vertical alignment in table cells on Firefox browser

I've successfully managed to vertically center the contents of .onesizechart in Chrome and Safari, but I'm facing issues with Firefox and IE. Interestingly, the contents of .homepage-sizechart are displaying correctly, leading me to believe that ...

Element escapes flex container boundaries

I'm facing an issue with styling a component that is taller than its flex container. My goal is to have a scroll appear for the component when it exceeds the height of the flex container, while keeping the footer at the bottom of the parent container. ...

Conflict with choosing options identified when using Select Box on IOS iPad mini

I am currently attempting to display a select box with scrolling on an iOS iPad mini. Issue: The options are not appearing inside the select box, instead they are overflowing outside of it in the popover. CSS .indicators_geography { font-size: 12px; ...

How can I specifically target and count children from a certain class using CSS selectors?

Consider this HTML structure with items arranged at the same level: <div class="h2">Title: Colors</div> <div class="pair">Hello world (1)</div> <div class="pair">Hello world (2)</div> <div class="pair">Hello wo ...

In Firefox 50.0, the button's resizing feature causes the parent div container outline to adjust size

I am currently working on developing a responsive design with the feature of having a button that appears to "float" under a div element. My desired outcome is achieved in Opera and Chrome: https://i.sstatic.net/Vm55V.png In Firefox, the result is not as ...

Activate an iframe upon changing the media query

I am currently working on a webpage where I have included an image within an iframe. I am looking to change the content displayed inside the iframe based on different media query breakpoints. For instance, if the viewport has a minimum width of 900px, I ...

Limiting the click event to the parent div only

I've encountered a problem with my overlay setup. I have an overlay with a child div inside, and I want the overlay to close only when the user clicks on the overlay itself, not the child div. Even though I've implemented the closing function, it ...

What are some strategies for making mouseover content stand out in my timeline?

I am currently working on a project involving a small timeline that utilizes the hover function in jQuery. I've encountered an issue where duplicating list items causes the hovers to no longer function individually, as they are controlled by the dupli ...

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 ...

focusing on a single div amidst a sea of interwoven dynamically generated divs

I am currently working with the liferay framework and I am facing a challenge where I need to apply inline JavaScript to target a very specific div on my webpage. The catch is that this div is nested within multiple dynamically added divs with varying clas ...

What can I do to prevent my paragraph from extending down the entire page when adjusting the resolution?

I am facing an issue with my responsive website where the paragraph text appears as a long word tower when the screen size is reduced. How can I resolve this problem and reduce the space between the words? You can see the issue in the image here: https://i ...

How to adjust the banner image placement in Squarespace

I need the banner image to shift position on smaller screens, specifically those with a max-width of 414px. I want the focus to be on showcasing a specific product (a building) located on the right side of the image. This building should only appear on wid ...

Learn to implement height and width in Jquery functionality

Recently, I came across a jQuery script online that enhances the functionality of my ticketing software by allowing me to add videos to a wiki. However, there is an issue with the code as it doesn't specify a height or width for the video. Is there a ...

Fashionable selection form

I'm having trouble with styling my select form to have a background-color and border. I've tried applying CSS properties, but it doesn't seem to be working as expected. Here is the code snippet in question: <select class="size"> ...

When the resolution changes, the text shifts away from the bar in CSS

When I adjust the resolution of my display, the text on my top bar also changes. Can anyone help me fix this issue? In normal view: With changed resolution or smaller browser window: This is my HTML code: <body> <div class="top-panel"> ...

Are the maps intersecting within the field of vision?

I have 2 components in my angular application each showing a map from mapbox. Here is the code for one of the components: Component import { Component, OnInit } from '@angular/core'; import * as mapboxgl from 'mapbox-gl'; @Component( ...