Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

223
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda