Bootstrap 4: Arrange input fields in a horizontal layout

I'm a newbie when it comes to Bootstrap 4 and could use some guidance. I'm looking to have my first two input fields aligned horizontally on the same line, instead of stacked on top of each other. Something like this:

check out the image here

Below is the HTML code I currently have:

  <div class="container">
    <div class="row">         
      <div class="form-group col-md-6 offset-md-3">             
        <input class="form-control transparent-input" type="text" name="name" placeholder="Name" required>
      </div>        
      <div class="form-group col-md-6 offset-md-3">
        <input class="form-control transparent-input" type="text" name="surname" placeholder="Surname" required>
      </div>
      <div class="form-group col-md-6 offset-md-3">
        <textarea class="form-control transparent-input" cols="20" rows="10" placeholder="Enter your message"></textarea>              
      </div>
    </div>
    <div class="row">
      <div class="form-group col-md-6 offset-md-3">
        <button type="button" class="btn btn-primary">Send</button>
        <!--<button type="submit" class="btn btn-default">Send invitation</button>-->
      </div>
    </div>
  </div>

Any assistance would be greatly appreciated!

Answer №1

Give this method a try. Hopefully, it will help you achieve the style you desire.

<div class="container">
        <div class="row">
            <div class="form-group col-md-6">
                <input class="form-control transparent-input" type="text" name="name" placeholder="Name" required>
            </div>
            <div class="form-group col-md-6">
                <input class="form-control transparent-input" type="text" name="surname" placeholder="Vorname" required>
            </div>
            <div class="form-group col-md-12">
                <textarea class="form-control transparent-input" cols="20" rows="10" placeholder="Enter your message"></textarea>
            </div>
            <div class="form-group col-md-12">
                <button type="button" class="btn btn-primary">Send</button>
            </div>
        </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

Activate Popover with Hover and simply click anywhere to dismiss

Currently utilizing Bootstrap 4 and intrigued by the popover feature that activates on hover and closes when clicked anywhere. I'm also interested in making links functional within the popover. Any suggestions or tips on how to achieve this? $(doc ...

Looking for assistance with HTML/CSS code

Adding the code snippet below into my Shopify product-liquid file caused chaos on the page, altering the font and even changing the shape of the add to cart button... The problematic code is shown below: <div id="shopify-section-product-icon-gallery" ...

Creating multiple blocks with a 100% height in HTML

Is it true that a parent element must have a fixed height to use percentage-based height? For example, 500px. I'm designing a grid with divs arranged hierarchically. The parent has a fixed height of 500px, and the children have percentage heights, ea ...

Adjust the size of the font based on the screen resolution

What is the best way to adjust font size based on screen resolution so that text remains as a single line when the screen is small? For example: http://prntscr.com/2qa9ze <div class="centerbreaking"> <section id="breaking-news"> <div id ...

JavaScript for switching between grid layouts

I have organized 3 DIVs using a grid layout. There is a Navigation bar with an on-click event attached to it. When a button on the nav-bar is clicked, I want the JavaScript function to display the corresponding grid associated with that button. Currently, ...

Separate the webpage into distinct sections for effective web design

I'm attempting to create a collapsible sidebar for mobile phones. However, after the first three images, the subsequent images on the next line appear below the sidebar instead of beside it. The top part looks fine, but as I scroll down to view the o ...

Say goodbye to using 'jQuery .load()' with <img> elements inside <a> tags

I have a static HTML page and some other files with the same structure but different content. <div id="textRed" class="scrollbar"> <h1>Header</h1> <p>Lorem Ipsum</p> <a href="images/image1.jpg" data-lightbox ...

Ways to display and conceal a div when hovering over another div

Currently, I have 4 divs grouped under the class "menubut." I am attempting to create a small overlay that appears when hovering over the menubut classes. Additionally, I want another div called "red" to show up about one-tenth of the size of the menubut ...

Silky animations in kinetic.js (html5 canvas)

I am seeking a better grasp on kinetic.js animation. Recently, I came across a tutorial at . After experimenting with the code provided, I managed to create an animation that positions my rectangle at x coordinate 100. However, I am struggling to achieve s ...

Scale first, then drag and drop to fix a faulty registration

I'm currently working on a project that involves dragging and dropping the correct items onto a technical drawing, such as a motherboard. The user is presented with pictures of components like CPUs or DDR memory and must drag these items to their corr ...

The Popover style from React-Bootstrap seems to be missing when applied to my component

Attempting to incorporate a Popover with overlay trigger from React - Bootstrap has proven to be quite the challenge. If you check this image, you'll see what it's supposed to look like. This is the code I used: var {Button, Overlay, OverlayTr ...

Issue with converting form data to JSON format

Having an issue converting a filled form in HTML to a JSON request for sending to the server via HTTP POST. Despite having a filled form, the JSON request only shows an empty array. Here is the JavaScript snippet: $("#submitSurveyBtn").on("click", functi ...

What is the best way to create a sign-up box that appears on the same page when you click on the sign-up button

I am interested in implementing a 'sign up' box overlay at the center of my index page for new users who do not have an account. I would like them to be able to easily sign up by clicking on the 'sign up' button. Once they complete the ...

What is the best way to split an image in half without displaying it and avoiding any horizontal scrolling on the page?

https://i.sstatic.net/Kj99o.png https://i.sstatic.net/W1BQ8.png Trying to align the two images shown above, but facing issues with making it responsive. The SVG image exceeds the container boundaries, causing horizontal scrolling. The goal is to have the ...

What is the best way to erase information displayed when hovering over an element using mouseout?

Whenever the user hovers over an image, an information box appears regarding that specific image. The information inside the box changes as I move over another image, but when not hovering over any images, the information box remains visible. Unfortunately ...

Using Responsive Design with Bootstrap and Media Queries

As a beginner in front-end development, I have recently learned about media queries and their functionality. Having previously studied Bootstrap, I can't help but wonder if media queries are actually necessary. After all, Bootstrap seems to offer simi ...

`inline-block elements are centered when displayed in Firefox`

I have a question regarding formatting h2 and h3 elements to display as inline-block. Below is the code snippet: <div id="content" class="content-width"> <h2 class="headline"> My Headline </h2> <h3 class="subheadline"> My S ...

The Sticky Navigation Bar Disappears After a Certain Scroll Point

Looking for some help with my website's navbar - it works fine until I scroll past the blue section, then it disappears along with other elements. Any suggestions on how to fix this? Thanks! <!DOCTYPE html> <html lang="en"> <h ...

Determine if the given text matches the name of the individual associated with a specific identification number

Struggling to create a validation system for two sets of fields. There are 6 inputs in total, with 3 designated for entering a name and the other 3 for an ID number. The validation rule is that if an input with name="RE_SignedByID" contains a value, then c ...

Challenges faced when integrating Angular with Bootstrap elements

I am currently in the process of developing a website using Angular 12, and although it may not be relevant, I am also incorporating SCSS into my project. One issue that I have encountered pertains to the bootstrap module, specifically with components such ...