Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

218
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda