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

412
Visualizações
Cómo centrar botones en un div

Aquí está mi CSS y HTML.

 .btn-group button { border: 3px solid green; padding: 10px; background-color: #04AA6D; /* Green background */ border: 1px solid green; /* Green border */ color: white; /* White text */ padding: 10px 24px; /* Some padding */ cursor: pointer; /* Pointer/hand icon */ float: left; /* Float the buttons side by side */ } .btn-group button:not(:last-child) { border-right: none; /* Prevent double borders */ } /* Clear floats (clearfix hack) */ .btn-group:after { content: ""; clear: both; display: table; } /* Add a background color on hover */ .btn-group button:hover { background-color: #3e8e41; }
 <div class="btn-group"> <button type="button" class="button1">Faucet</button> <button type="button" class="button2">About Nano/Faucet</button> <button type="button" class="button3">Donate</button> </div>

Imagen De Botones

¡Quiero centrar estos botones debajo del texto en el centro de la pantalla! He probado tantas cosas que nada me funciona.

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

Desea usar flex en .btn-group y hacer que tome el 100% del ancho del padre para estirar el div.

 .btn-group { width: 100%; display: flex; justify-content: center; background-color: skyblue; } .btn-group button { border: 3px solid green; padding: 10px; background-color: #04AA6D; /* Green background */ border: 1px solid green; /* Green border */ color: white; /* White text */ padding: 10px 24px; /* Some padding */ cursor: pointer; /* Pointer/hand icon */ } .btn-group button:not(:last-child) { border-right: none; /* Prevent double borders */ } /* Clear floats (clearfix hack) */ .btn-group:after { content: ""; clear: both; display: table; } /* Add a background color on hover */ .btn-group button:hover { background-color: #3e8e41; }
 <div class="btn-group"> <button type="button" class="button1">Faucet</button> <button type="button" class="button2">About Nano/Faucet</button> <button type="button" class="button3">Donate</button> </div>

about 4 years ago · Juan Pablo Isaza Relatório

0

Puedes agregar a tu css:

 .btn-group{ display:flex; justify-content:center; }

se verá así

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza Relatório

0

Puedes usar flex box

 .btn-group { display:flex; flex-direction: row; justify-content:center; } .btn-group button { border: 3px solid green; padding: 10px; background-color: #04AA6D; /* Green background */ border: 1px solid green; /* Green border */ color: white; /* White text */ padding: 10px 24px; /* Some padding */ cursor: pointer; /* Pointer/hand icon */ } .btn-group button:not(:last-child) { border-right: none; /* Prevent double borders */ } /* Clear floats (clearfix hack) */ .btn-group:after { content: ""; clear: both; display: table; } /* Add a background color on hover */ .btn-group button:hover { background-color: #3e8e41; }
 <div class="btn-group"> <button type="button" class="button1">Faucet</button> <button type="button" class="button2">About Nano/Faucet</button> <button type="button" class="button3">Donate</button> </div>
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