Tips for utilizing flexbox to position a button to the right of an InputSelect

Struggling to position a button next to a dropdown? No matter what I attempt, the button keeps ending up above the dropdown. Ideally, I'd like it to appear alongside 'Select Organisation' as shown in the image below:

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

Here's the code snippet with the InputSelect and the troublesome button:

<div class="form-group row mb-3">
    <div class="col-auto">
        <div class="form-floating">
            <InputSelect id="Organisation" class="form-select" @bind-Value="Meeting.OrganisationId">
                <option value="0">Select Organisation:</option>
                @foreach (var org in Organisations)
                {
                    <option value="@org.Id">@org.Name</option>
                }
            </InputSelect>
            <button type="button" class="btn btn-primary d-flex justify-content-end"><span class="oi oi-plus"></span></button>
            <label for="Organisation">Organisation</label>
        </div>
        <ValidationMessage For="@(() => Meeting.OrganisationId)" />
    </div>

I've experimented with float-end and pull-left too.

Answer №1

If you add flex-direction to the parent of the button and inputselect, it should resolve your issue.

.container {
  display: flex;
  flex-direction: row;
}
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d3b1bcbca7a0a7a1b2a393e6fde1fde3">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet"/>
 <div class="form-group row mb-3">
    <div class="col-auto">
        <div class="form-floating container">
            <InputSelect id="Organisation" class="form-select" @bind-Value="Meeting.OrganisationId">
                <option value="0">Select Organisation:</option>
                @foreach (var org in Organisations)
                {
                    <option value="@org.Id">@org.Name</option>
                }
            </InputSelect>
            <button type="button" class="btn btn-primary d-flex justify-content-end"><span class="oi oi-plus">Button</span></button>
            <label for="Organisation">Organisation</label>
        </div>
        <ValidationMessage For="@(() => Meeting.OrganisationId)" />
    </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

ensure that angular's ng-if directive sets aside space to display content when triggered by an event

I'm facing an issue with my modal form setup where if a text-field is left blank, a label saying "it is required" is generated below the field, causing the "Proceed" button to move (along with all other elements below it). How can I make sure that DOM ...

Utilize various CSS styles for text wrapping

I'm struggling to figure out where to begin with this problem. My goal is to create a three-column row that can wrap below each other if they cannot fit horizontally. The height of the row should adjust to accommodate the items while maintaining a fix ...

Show the JSON response from the controller on the view page

In my controller, I have a JsonResult action that returns a list of House objects. My goal is to retrieve this data onclick using ajax and display the JSON data within my view. While I can see the proper response and JSON result in Firebug, I'm not su ...

Is there a way to compel WPF to utilize resource URIs with the assembly's strong name? Ugh, the struggle is

It's really frustrating to see the issues with WPF generated code not utilizing strong names, causing problems for supporting side by side versions of assemblies. This is particularly troublesome for my plug-in system designed to accommodate plugins w ...

Struggling to combine select dropdown choices in one calculation

​​I'm currently working on a project where I need to create a website that multiplies three numbers selected from dropdown menus together. However, when I attempt to perform the calculation, I only get the result "1" displayed. I've spent sev ...

Converting a GET request from Entity Framework to a GET request without using Entity Framework

I have been learning ASP.NET MVC & Angular through an online tutorial, but the author, Sourav Mondal, uses Entity for database querying. Unfortunately, I am working with SQL Server 2000 and EF is not feasible in this context. Below is the code snippet that ...

The Google map is not appearing when placed within the "row" class

My goal is to showcase Google Maps on my website, and every time I try to do so using the following code: <div class="large-12 columns" id="map-canvas"></div> The map displays perfectly and works as expected. However, when I nest this div wi ...

Is there a way to choose columns 2 to 6 of the row that is currently selected

I am looking to create a hover effect for columns 1 through 7 of a row where, when the user hovers over any column within that range, certain styles are applied to all columns in the row except for columns 1 and 7. This means that the background color shou ...

The Jquery navigation and image display features are experiencing technical difficulties in Internet Explorer

My website is currently in the development stage and functions well on all browsers except for IE10. Interestingly, both the menu bar and photo gallery, which rely on Jquery, are not functioning properly in IE10. Below is the code snippet: <script ty ...

InvalidSelectorError: The specified selector is not valid //button[contains(., 'buttonText')] while running JavaScript code

Here's an example of HTML code that I am working with: <button id="toolbar-item-17-update-id" type="submit" name="action" value="update" class="button-action-update btn btn-secondary"> Ed ...

Text overlay on image sliders inside div containers

Is there a way to display div elements on top of an image slider, rather than behind it? I've tried using z-index and position: absolute with no success. Here is an example: HTML: <div id="header"> <img src="assets/images/header1.png" / ...

The background image fails to load the specified image

I am encountering an issue with utilizing background-image in the style of my HTML page. I am currently developing a login page for my Django application, and when I preview the page, the background image does not appear. Strangely, this code was functioni ...

Spotting the Visible Element; Detecting the Element in

Currently, my webpage has a fixed header and I am facing the challenge of dynamically changing the styling of the li elements within the navigation based on the user's scrolling position. To achieve this, I believe the most effective approach would b ...

The JSON response generated by the C# ServiceContract is not quite what I was anticipating

Currently, I am utilizing a service contract as an API with a particular interface declaration: namespace MyAPI { [ServiceContract(Namespace = "http://MyAPI")] public interface IMyAPI { [OperationContract] [WebInvoke(Method = " ...

Is it possible to utilize the lighten css property within ngStyle in Angular?

Having some trouble with the lighten property in ngStyle and it's not working as expected. I have a color variable within my component that I want to utilize like so: <div [ngStyle]="{color: schedule.group.color, background: 'lighten(' ...

The grid feature in the Bones theme is malfunctioning and causing issues

I am currently using the Bones theme from Themble, which has a grid system in its design. I attempted to apply this grid system to the header of my website in order to transform menu items into icons on mobile devices and display the full menu on desktop s ...

Scrolling a table to the current ng-init date in AngularJs: What’s the best approach?

I found a code snippet in my DOM that sets the current date on a table. <table id="daysTableLeft" class="table table-hover" ng-init="getHorraire(pickDateRow,$index,0)"> <tr ng-repeat="fd in getFullDayDate track by $index ...

Ways to divide background color in half using CSS

Looking for some help with CSS - I want to split an HTML page into two sections, with a background and text/login form on top. Can anyone provide sample CSS and HTML code? This is what I've tried so far in CSS: .logindiv { height: 200px; width: ...

When publishing, TypeScript-compiled JS files fail to be included, even though they are included during the build process in Debug and Release modes

My .NET MAUI project includes TypeScript files in the Scripts\scriptfiles.ts folder, which are compiled into wwwroot\js\scriptfiles.js. Everything functions properly until my client attempts to publish it, at which point all script files go ...

Is there a way to automatically add a div to the window as the user scrolls and then hide the div when they scroll back to the

Seeking assistance with creating a function that will add a 'sticky' class to the menu when the user scrolls down to the middle, and then append a div when the 'sticky' class is present. Currently facing issues where the div keeps appen ...