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

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

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 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