css - break-before:页面在 Mozilla Firefox 中不起作用
问题描述
今天在我的日常工作中,我遇到了这个有趣的错误。我们在一个容器中有两个 div 和许多其他父级。我们想在两个 div 之间粘贴一个分页符,在第二个 div 之前。但是当打印firefox时拒绝分页。铬和即工作正常。
我们有这个html结构:
<div class="flex">
<header></header>
<div>
<div>
<section>
<div>
<div class="first"></div>
<div class="second"></div>
</div>
</section>
<aside></aside>
</div>
</div>
<footer></footer>
这个CSS:
.flex {
display: flex;
}
.first,
.second {
width: 90vw;
height: 50px;
margin-bottom: 10px;
}
.first {
background-color: coral;
}
.second {
background-color: lightblue;
}
@media print {
.second {
break-before: page;
}
}
解决方案
修复很简单:
.flex {
display: block;
}
推荐阅读
- c++ - C++ 句子回文
- tensorflow - tensorflow如何填充像pytorch的'collate_fn'这样的批处理文本?
- google-api - 如何让 Google Home (Mini) 发布它收听的 MQTT 主题(和代理)?
- node.js - API 调用中所有函数的 1 db 连接
- c++ - 如何使 if else 语句与 cin 语句一起使用?
- c# - 如何验证 Google ID 令牌,C# 问题
- java - 为什么它说错误:';' 当我编译它时预期?
- git - git rm --cached 命令中的路径是什么?
- text - 我需要识别这种文本格式
- php - 如何将数组作为 Laravel 查询生成器的 SELECT 参数传递