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

128
Visualizações
why I can not put button element while parent have height with percent?

I have a div with 15% height (height: 15%;)

I can not put set span button of this div. If I use height: 300px; it works well. but with percent height does not work. why?

#parent {
  height: 15%;
  position: relative;
}

span { 
  position: absolute;
  bottom: 0;
}

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

0

You can fill the height of the body by using 100vh;

body {
  height: 100vh;
}

#parent {
  position: relative;
  width: 15%;
  height: 15%;
  background-color: red;
}

span {
  position: absolute;
  color: white;
  text-align: center;
  width: 100%;
  bottom: 0;
}
<div id="parent">
  <span>Hello</span>
</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