Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to putting elements next to each other in a div with display flex inline

I’m new to html/css, creating my first toy website to learn a little.

One of the pages is a form and I want to display inline the last element (a text area box) with the submit and clean buttons. The submit button should be next to the box aligned at the bottom end.
I manage to align the buttons at the bottom but I can’t put them next to the box, it’s all occupying the same space.
This is the code I have so far:

<div style="display: inline-flex">
    <label for="comments" style="float:left">Comments:<br>
       <textarea class="form-control" style="min-width: 300%" rows="6"  name="comments"></textarea>
    </label>
    <label style="align-self: end; float: right">
         <input type="submit" value="Submit"/>
         <input type="button" onclick="...'; return false" value="Clean">
    </label>
</div>

And this is how it looks:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

I can see that the display: flex; justify-self: right has no effect, I can remove it or change it for justify-self: right and it looks the same.
I found many related questions and tried different combinations of the proposed solutions but none of them worked. Some of this things I tried for the buttons are:

style="align-self: end; display: flex; justify-self: right"
style="align-self: end; float: left"
style="align-self: end; margin-left: auto; margin-right: 0"

They all look basically the same.
I’d appreciate any help with this.

Thanks!

>Solution :

Change the textarea’s min-width 300% to specific px.

.wrap {
   display: inline-flex;
}

.comments{
   margin-right: 10px;
}

.form-control {
   min-width: 300px;
}

.button {
   align-self: end;
}
<div class="wrap">
   <label class="comments" for="comments" >Comments:<br>
           <textarea class="form-control" rows="6" name="comments"></textarea>
   </label>
   <label class="button">
           <input type="submit" value="Submit"/>
           <input type="button" onclick="...'; return false" value="Clean">
   </label>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading