html - 使用 css 从打印页面中删除 URL

标签 html css printing

<body>
 <div class="print-logo">
  <img class="print-logo img-responsive" id="logo" src="http://logo.png" alt="image" /></div>
    <div class="print-site_name">Published on <em class="placeholder">website name</em> (<a href="http://localhost">http://localhost</a>)</div>
<p />
<div class="print-breadcrumb"><a href="/">Home</a> Reportedly Prepping </div>
<hr class="print-hr" />
    <div class="print-content"><article id="node-ID" class="node node-blog clearfix">   
<div class="bd-headline left"> some title  </div>    
<div class="item-body">
 <p dir="ltr"><span id="docs-internal-guid-???">    
  <img alt="Core" height="366" src="http://image.png" width="645" />  
   <span> contributor helping  report. It’s the latest nightmare.</span><a href="http://url-to-be-removed">some text for the url to be removed(http://url-to-be-removed) then some more text.  
 </p>   
 <p> some more text and another url</p>
</div>   
...   

如何使用 CSS 删除 URL。由于 URL 在正文中,我尝试使用类名和 html 标记:

div.print-content article.node .node-blog .clearfix div.item-body p a { content: "";}   

更新
我要删除的部分是粗体
贡献者帮助报告。这是最近的噩梦。 some text for the url to be removed (http://url-to-be-removed ) 然后是更多文本。

最佳答案

要从打印媒体中删除 URL,请使用:

@media print {
  div.print-content article.node .node-blog .clearfix div.item-body p a {
    display: none;
}

如果您想要的是让它完全消失(从任何 Angular 来看),只需添加 div.print-content article.node .node-blog .clearfix div.item-body p a { display: none; }

以这种方式添加它会将其从文档 View 中完全删除,从而释放 <a> 占用的所有空间。标签。

关于html - 使用 css 从打印页面中删除 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39905253/

相关文章:

java - PDF PrinterJob 获取作业状态

html - 当我尝试打印页面时,CSS 样式不适用于特定 div 中的跨度

graphics - 将打印输出捕获为矢量格式(PDF、SVG、EMF 等)

HTML/CSS hack 允许 overflow-x : auto & overflow-y: visible?

html - 无法居中绝对位置 (Tailwind.css)

php - 缩小浏览器大小后无法扩展wordpress网站的导航

javascript - 根据选定的单选按钮更改选项值

html - 删除 Div 之间的间距

html - 如何阻止表格移动

javascript - 如何根据在另一个日期选择器中选择的月份在一个日期选择器中显示月份