Mat*_*ord 9 html css printing ms-word
我似乎无法找到一种一致的方法来创建一个可以跨word,Internet Explorer和chrome工作的分页符.
以下示例(来自Google Chrome打印分页符)将为Chrome和Internet资源管理器正确创建分页符,但在单词中没有分页符.
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Paginated HTML</title>
<style type="text/css" media="print">
div.page
{
page-break-after: always;
page-break-inside: avoid;
}
</style>
</head>
<body>
<div class="page">
<h1>This is Page 1</h1>
</div>
<div class="page">
<h1>This is Page 2</h1>
</div>
<div class="page">
<h1>This is Page 3</h1>
</div>
</body>
Run Code Online (Sandbox Code Playgroud)
在弄乱了我发现的单词后,您可以通过以下内容添加分页符:
<br style="ms-special-character:line-break;page-break-before:always" />
Run Code Online (Sandbox Code Playgroud)
这里的问题是Internet Explorer也看到这是一个分页符,所以如果你结合使用这些方法,Chrome和Word会正确分页,但Internet Explorer会插入两个分页符.如果你只使用一个,那么chrome和explorer是正确的,而word不是,依此类推.
尝试这个:
<!--[if IE]>
<br>
<![endif]-->
<!--[if !IE]>
<br style="ms-special-character:line-break;page-break-before:always" />
<br>
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
这符合您的需求吗?(注意,这些在普通的旧 html 中工作。我在 Chrome 和 MS Word(以及 IE)中进行了测试,它们工作得很好。)
归档时间: |
|
查看次数: |
7435 次 |
最近记录: |