Jit*_*yas 7 css printing xhtml cross-browser
什么是最有用的media="print",跨浏览器兼容的CSS属性?
我认为我们有这5个属性用于打印特定.
请解释何时何地使用这些?哪些是跨浏览器兼容的?什么是其他常见的CSS属性可用于打印,除了display:none?
当我需要制作页面的可打印版本时,我使用着名的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) ") ";
}
Run Code Online (Sandbox Code Playgroud)
我使用以下内容:
/* Browser will TRY to avoid spanning content within across a page */
tr, td, th {page-break-inside:avoid}
/* Repeat table headers when table spans a page */
thead {display:table-header-group}
/* Apply to anything you don't want to print */
.NoPrint {visibility:hidden; display:none}
Run Code Online (Sandbox Code Playgroud)