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

146
Vistas
Print only one element with @media print using react

I am having a little drag and drop game, this game has a how-to-play button that opens a modal with text and guides with it, when I click to print( real-life print) I want to show only that one element nothing else. That's where I need your help.

I tried to do this with CSS:

@media print {
  body {
    visibility: hidden;
  }
  .modal-window {
    visibility: visible;
  }
}

Thought this would help but this shows me only a blank page,somehow I need to print only the my Modal.js element which has a div with a class of .modal-window.

If I open the modal (click to the howtoplay button) I get it right, but my task is to do this without clicking on that button.

Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You're hiding body. Your modal window element is in body so it's hidden as well.

Try hiding everything in body except modal window

body *{
    visibility:hidden;
}

body .modal-window {
    visibility: visible;
}
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