Search code examples
cssprintingtwitter-bootstrap-3print-preview

Hide urls when printing a page


I have this webpage: enter image description here

It looks like this when I try to print it: enter image description here

It's missing the last item (user management) intentionally so that's not a problem. But I'd like to hide the "(/campaigns)" and "(/profanity)" from the print.

Is that possible using CSS?

--EDIT-- This is the HTML:

<div class="row">
    <div class="item col-xs-12 col-sm-6 col-md-4 text-center">
        <div class="lead">Campaigns</div>
        <a href="/campaigns" class="text-muted">
            <i class="fa fa-bullhorn"></i>
        </a>
        <table class="table table-striped table-condensed">
            <tbody><tr>
                <th>Campaigns active</th>
                <td>1/1</td>
            </tr>
            <tr>
                <th>Total posts</th>
                <td>149</td>
            </tr>
        </tbody></table>
    </div>
    <div class="item col-xs-12 col-sm-6 col-md-4 text-center">
        <div class="lead">Profanity</div>
        <a href="/profanity" class="text-muted">
            <i class="fa fa-filter"></i>
        </a>
        <table class="table table-striped table-condensed">
            <tbody><tr>
                <th>Created profanity filters</th>
                <td>0</td>
            </tr>
            <tr>
                <th>Total words filtered</th>
                <td>0</td>
            </tr>
        </tbody></table>
    </div>
        <div class="item col-xs-12 col-sm-6 col-md-4 text-center">
        <div class="lead">User management</div>
        <a href="/account" class="text-muted">
            <i class="fa fa-users"></i>
        </a>
    </div>
    </div>

Solution

  • I recognize the classes, this is a bootstrap issue, as you will find in bootstrap.css this rule

    @media print {
      ...
      a[href]:after {
        content: " (" attr(href) ")";
      }
      ...
    }
    

    overwrite this rule and you should be golden, eg content:none;