Hide buttons while printing, using window.print()

Asked

Viewed 758 times

0

I have a list where the user can print through the window.print(), but is appearing the 2 buttons that has on the page. inserir a descrição da imagem aqui

It is possible to "hide" these buttons through the CSS at the time of printing?

BUTTONS

<div>
<a href="listagem_cliente.php"><button type="button" class="btn btn-primary">Voltar</button></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<a href="javascript:;" onclick="window.print();return false"><button type="button" class="btn btn-danger" title="Imprimir">Imprimir</button></a>
 /div>  

1 answer

1


I got it here!

CSS

<style>
@media print { 
#noprint { display:none; } 
body { background: #fff; }
}
</style>

HTML

<div id="noprint">
<a href="listagem_cliente.php"><button type="button" class="btn btn-primary">Voltar</button></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<a href="javascript:;" onclick="window.print();return false"><button type="button" class="btn btn-danger" title="Imprimir">Imprimir</button></a>
</div>  

Browser other questions tagged

You are not signed in. Login or sign up in order to post.