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

118
Vistas
h3 not displaying in absolutely positioned div

Im having difficulty displaying my h3 on the page. I have an absolutely positioned div that is going to move around my window. Inside I have an image and an h3 that moves when the div is moves. The image is displaying on the screen but the h3 is not. The height of the h3 is 0, I've tried using the clearfix trick, setting width/height and overflow: auto, but to no avail.

.asteroid {
        position: absolute;
}
.asteroid-name {
    color: white;
    font-size: 2rem;
}
<div class="asteroid">
    <h3 class="asteroid-name" style="display: block">
    <img .... width, height and a rotation specified here>
</div>

The reason I specify display block for the h3 is because I am adding all these elements through my JS. Each one of these divs is generated based on an object I receive from an API. I initially have 2 h3s, both set to "display: none" and based on the direction of travel, I choose to either display the h3 above this img, or an h3 that would be below it

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Correct me if I'm wrong but the h3 element you have specified in your example contains no content and has no closing tag, so I don't understand what you're expecting to see?

See below code example where I've added content and the closing tag.

.asteroid {
  position: absolute;
  background-color: blue;
}

.asteroid-name {
    color: white;
    font-size: 2rem;
}
<div class="asteroid">
  <h3 class="asteroid-name" style="display: block">Test</h3>
  <img src = "https://via.placeholder.com/150">
</div>

about 4 years ago · Santiago Trujillo 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