1

I' am having a small issue where I cannot remove the link reference from the print view.

This is what I can on my HTML side

<table style="width: 436px; height: 374px;" border="0" cellpadding="5">
    <tbody>
        <tr style="background-color: #edfbef;">
            <td><span style="color: #3366ff;"><a title="Electricity Tariffs and Rates" href="http://newfea.oceanic.net.fj/your-home/electricity-tariffs-and-rates/"><span style="color: #3366ff;"><strong>Electricity Tariff &amp; Rates</strong></span></a></span></td>
            <td>Find out how you are being charged for the power you use at home</td>
        </tr>
    </tbody>
</table>

This is what I have on my header.php page for media queries

<link href="<?php echo get_template_directory_uri(); ?>/resources/css/print.css" rel="stylesheet" media="print">

Here is a snapshot how it looks in normal HTML View HTML VIEW

Here is the Media Print Vision enter image description here

You can see from the print view there are the link reference of the links. Is there a way I can remove this using CSS.

I have tried display: none, visibility: hidden, its doesn't because it hides the whole link text with it.

Navneil Naicker
  • 3,586
  • 2
  • 21
  • 31

4 Answers4

4
@media print {
  a[href]:after {
    content: none !important;
  }
}

Try to override your print media by the above code.

Kawinesh S K
  • 3,148
  • 1
  • 16
  • 29
2

REFERENCE LINK : HERE

<span class="printonly"><strong>Electricity Tariff &amp; Rates</strong></span>

ADD THIS NEW SPAN ABOVE TD.

[NOTE : ADDING CLASS "printonly" to NEW <td> for PRINT ONLY.]


WE WILL HIDE BELOW TD WHILE PRINTING USING ATTACHED CSS

[NOTE : ADDING CLASS "withoutprint" to your <td> ]

  <span class="withoutprint" style="color: #3366ff;">
     .....
       .....

CSS

.printonly{
    display:none;
}
    @media print {
    .withoutprint{
        display: none;
    }
    .printonly{
        display:block;
        color: red;
    }
}
Community
  • 1
  • 1
Sandy
  • 663
  • 1
  • 4
  • 9
1

These links are placed there by your stylesheet. I am guessing you have used a theme or boilerplate.

Check the print styling in these stylesheets.

You are looking for something like this:

a[href]:after {
    content: " (" attr(href) ")";
}

You would want to remove that.

3dgoo
  • 15,716
  • 6
  • 46
  • 58
1

Try like this:

CSS:

@media only print {
    a { text-decoration: none; color: black; cursor: default; }
}

@media only screen {
    a { cursor: pointer; }
}

DEMO

Ahsan Khurshid
  • 9,383
  • 1
  • 33
  • 51