打印样式的CSS

 1 @media print{
 2     *,
 3     *:before,
 4     *:after{
 5         background:transparent !important;
 6         color:#000 !important;
 7         box-shadow: none !important;
 8         text-shadw:none !important;//所有颜色的背景清除
 9     }
10     a,
11     a:visited{
12         text-decoration: underline;//所有的链接加上下划线 一看能知道是链接
13     }
14     a[href]:after{
15         content: '('attr(href)')';//如果一个超链接有内容的话,可以加上这个样式,告诉这个链接是什么
16     }
17     abbr[title]:after{
18         content:'('attr(title)')';
19     }
20     a[href^='#']:after,a[href^="javascript:"]:after{content: '';}//使用#号和JavaScript的超链接不显示href
21   //避免在原始内部插入分页符
22    pre,blockquote{
23        border:1px solid #999;
24        page-break-inside: avoid;//这个属性只有op浏览器起作用
25    }
26    thead{
27        display: table-header-group;
28    }
29    tr,
30    img{max-width: 100% !important;}
31    p,h2,h3{
32        orphans: 3;//当元素发生分页时必须在页面底部保留的最小行数
33        widows: 3;//当元素发生分页时必须在页面顶部保留的最小行数
34    }
35    h2,h3{page-break-after: avoid;}//避免在元素后面插入分页符
36 }

 

转载于:https://www.cnblogs.com/karry990921/p/8110910.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值