The button is not aligning with the textarea on the same row

Below is an image showing that the button is not properly aligned next to the textarea:

https://i.sstatic.net/2LeXv.png

Here is the HTML code snippet:

<div>
      <form>

          <textarea  name="comment" id="new-post" rows="2" cols="45" placeholder="Add a comment"> 
          </textarea>


         <button type="submit" class="btn btn-primary float-right" style="display: inline-block;" 
          align="right">Add comment</button>
     </form>

</div>

Answer №1

One way to achieve this is by utilizing Flex to make them behave as inline elements.

form {
  display: flex;
  flex-direction: row;
}
<div>
      <form>

          <textarea  name="comment" id="new-post" rows="2" cols="45" placeholder="Add a comment"> 
          </textarea>


         <button type="submit" class="btn btn-primary float-right" style="display: inline-block;" 
          align="right">Add comment</button>
     </form>

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

Customize the color of the hamburger icon in Vue Bootstrap

I am struggling to change the color of the Vue Bootstrap Hamburger navbar-toggler-icon to white. Despite trying numerous code combinations, I have not been successful. Each time I load the app, the CSS defaults back to the original bootstrap URL. Do you ha ...

Clickable CSS3 animations

Currently exploring the fundamentals of CSS3 animation and onclick events, but I've hit a roadblock. My objective is to utilize button id="3" to initiate the animation on the red square displayed here: https://jsfiddle.net/4swmegpn/ Additionally, I a ...

utilize the form select element rather than the iframe

My sidebar is 200px wide and 300px tall, but my list of links has grown to fill the entire height of the sidebar. I am unsure of the best approach moving forward: Option 1) Embed the list in an iframe and allow the user to scroll through it. Option 2) Ut ...

Ways to ensure a div matches the size of the div above it within a Boostrap grid column

Hello there, this is my very first question on this platform. I'm still in the early stages of learning all these concepts, so please be patient with me ...

What are the steps for using Curl to pass parameters and values in a request?

I'm attempting to make a curl request to a webpage using GET to send parameters with their values. It works for the first two, but the last one "a-listibg-pro" keeps causing issues, possibly due to the hyphen. Any assistance would be appreciated. cur ...

Conceal a list of items within a div that has a particular class

This is a sample of my HTML code: <div class="row"> <div class="col-md-12"> <div class="scrollbox list"> <ul class="list-unstyled"> <li id="articulate.flute">articulate flut ...

The form data is being passed as null to HttpContext.Current.Request

My file upload module is working well with Postman without any content type. However, in the code, the file count always shows as 0 in the backend API. If anyone has any insights into what I might be doing wrong, please help me out. Thank you. Below is my ...

"Choosing the text within an <a> tag: A step-by

I am dealing with the a tag. <a href="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b4c7dbd9d1f4d9d5ddd89ad7dbd9">[email protected]</a>"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" ...

Icon: When clicked, initiate a search action

I am looking to make the icon clickable so that it can be used as an alternative to pressing the "return key" for searching. Check out this bootply example at . You simply need to click on the magnifying glass icon and it will initiate the search. ...

Ensure the accordion design is adaptable to various screen sizes and orientations, as it is currently only allowing

I'm struggling to achieve responsiveness with the FAQ Accordion on my website. When it initially loads collapsed, the space where it should expand appears blank. I need it to dynamically adjust and create more room when opened up. Additionally, when a ...

How can we allocate array elements dynamically within div elements to ensure that each row contains no more than N items using only HTML and JavaScript?

For instance, if N is 3 in each row, as more elements are added to the array, the number of rows will increase but each row will still have a maximum of 3 elements. I am currently using map to generate corresponding divs for every element in the arr ...

Styling hover effects on links in Bootstrap 4 with underlines

In Bootstrap 4, the anchor tags have the text-decoration: underline; property added only on hover. Is there a pre-existing helper or utility class to remove this underline? I went ahead and created my own helper class in CSS to remove the underline, but ...

Reorganize divisions using Bootstrap

I am exploring different ways to manage responsiveness through the reordering of divs. While I am aiming for a solution that is highly flexible, any suggestion would be appreciated. Desktop View: https://i.stack.imgur.com/boSOa.png Mobile View: https:// ...

What steps can be taken to resolve the unexpected padding issue in a Bootstrap form?

https://i.sstatic.net/iSz2e.png <form class="form-inline"> <div class="form-group"> <div class="input-daterange input-group" id="datepicker"> <label>Beginning:</label> <input type="text" ...

Trouble accessing Google Maps due to map loading issues?

I have tried numerous solutions to fix my issue, but none of them seem to work. My map just won't load. Here is the HTML snippet causing trouble: <script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script> <script> ...

Creating a Triangular Button with Icon Design with Bootstrap 4

I'm attempting to design a CSS triangular button that is positioned in the top left corner of a div using Bootstrap 4. Here's my concept as crafted with Photoshop: https://i.sstatic.net/cbUWL.png However, after numerous attempts, this is the c ...

Looking for assistance with accessing elements using the "document.getElementById" method in Javascript

Below is the code snippet I am working with: <html> <head> <script> function adjustSelection(option) { var selectList = document.getElementById("catProdAttributeItem"); if (option == 0) { ...

Disable the checkbox functionality in Angular

Is there a way to disable clicking on a checkbox while still keeping an ng-click function attached? <input id="record-2" type="checkbox" class="checkbox" ng-click="doIfChecked()"> I've tried using ng-readonly and ng-disabled, as well as css p ...

What is the best way to display letter p when hovering over an image?

Even though the issue of overlapping has been addressed before, I am struggling to center the text on top of the image when hovered. I have experimented with z-index, relative and absolute positioning, but I'm still seeking assistance. .flex-conta ...

Issue with Background Color in WordPress Simple CSS PostGrid

Currently in the process of developing a demo website at I am attempting to add a grey border (#eeeeee) around the Post Grid-Elements located at the top and bottom of the page. However, it seems like there is an error somewhere. Can someone help me identi ...