我有这个网页:
当我尝试打印它时它看起来像这样:
它故意遗漏了最后一项(用户管理),所以这不是问题。 但我想在打印中隐藏“(/campaigns)”和“(/profanity)”。
这可能使用 CSS 吗?
--编辑-- 这是 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>
最佳答案
@media 标签支持打印。
因此,如果您希望您的 block 在打印时不显示,请使用以下代码:
@media print {
.noprint {
display: none !important;
} }
只需将“noprint”添加到您想要的任何元素即可。
关于css - 打印页面时隐藏 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31070228/