Hide text from printing

I have a print page here:

http://www.souq4cars.com/ppreview.php?id=611111161&u=10064&t=users_cars

How can I hide the links below to print on the closed page "Close Window" and "Print Page"?

+3
source share
4 answers

You can use the CSS @media rule for this . To get started, add a class noprintto both elements:

<a class="noprint">foo</a>

and then add a rule @media printto your CSS that hides elements during printing:

@media print {
    .noprint {
        display: none;
    }
}
+10
source
@media print
{
  div.for_hide {
    display: none;
  }
}

or you can include some css in it by including

<link rel="stylesheet" type="text/css" media="print" href="/css/print_version.css">

in your html code.

+2
source

, css.

<link href="style-print.css" rel="stylesheet" media="print"  type="text/css">

divs, , :

<div style="float: right;" id="print">
                <a href="#" onclick="javascript:window.print(); return false;" class="orange_text"><strong>Print Page</strong></a>

            </div>

style-print.css divs hidden.

#print {
    display: none; 
}
+1

You must use the print stylesheet and hide the relevant elements by setting display: none.

You can include a print sheet by adding the following between the headers: <link rel="stylesheet" href="print.css" type="text/css" media="print" /> Usually you should set the attribute mediato screenor something like that.

0
source

Source: https://habr.com/ru/post/1723778/


All Articles