小编典典

什么是最有用的媒体=“打印”特定的,跨浏览器兼容的CSS属性?

css

media="print"跨浏览器兼容的特定于CSS 的最有用的属性是什么?

我认为我们有这5个特定于打印的属性。

  1. page-break-before
  2. page-break-after
  3. page-break-inside
  4. widows
  5. orphans

请解释何时何地使用这些?哪些浏览器兼容?除之外,还有哪些其他常见的CSS属性可用于打印display:none


阅读 364

收藏
2020-05-16

共1个答案

小编典典

当我需要制作页面的可打印版本时,会使用著名的A列表分开的文章CSS设计:要打印和这篇文章。有一些常用标签,但是很大程度上取决于您使用的CSS模型(以及容器填充和边距):

body {
   background: white;
   font-size: 12pt;
   }
#menu {
   display: none;
   }
#wrapper, #content {
   width: auto;
   margin: 0 5%;
   padding: 0;
   border: 0;
   float: none !important;
   color: black;
   background: transparent none;
   }
div#content {
   margin-left: 10%;
   padding-top: 1em;
   border-top: 1px solid #930;
   }
div#mast {
   margin-bottom: -8px;
   }
div#mast img {
   vertical-align: bottom;
   }
a:link, a:visited {
   color: #520;
   background: transparent;
   font-weight: bold;
   text-decoration: underline;
   }
#content a:link:after, #content a:visited:after {
   content: " (" attr(href) ") ";
   font-size: 90%;
   }
#content a[href^="/"]:after {
   content: " (http://www.alistapart.com" attr(href) ") ";
   }
2020-05-16