Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
How to center an element related to it's above sibling

I have a simple form as below picture

enter image description here

I want to center "Send" button related to the textarea below "Message" label. If I do this with position absolute, relative and custom margins, it looks different and not centered on different resolutions. I'm also using Bootstrap.

My form is inside a parent div;

            <div className="my-5 emailform">
              <form className="contact-form">

                ...other elements

                <h3>Message</h3>
                <textarea className="textarea" name="message" />
                <input className="sendbutton" type="submit" value="Send" />
              </form>
            </div>

So what I'm trying to accomplish is, I want to put "sendbutton" element below-middle of "textarea" element. So far all of my tries were not succesful. How can I center an element to it's sibling responsively?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

   .contact-form{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    }
            <div class="my-5 emailform">
              <form class="contact-form">

                ...other elements

                <h3>Message</h3>
                <textarea class="textarea" name="message" ></textarea>
                <input class="sendbutton" type="submit" value="Send" />
              </form>
            </div>

There are other methods too like you can give display: inline-block to form children and set their width: 100% and use text-align: center on the parent. But this is the safest.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!