css - CSS 打印和 Flexbox
问题描述
您好,我想使用 css 打印创建一些页面。我环顾四周,在网上尝试了一些东西,但遗憾的是对齐不起作用。
我要制作 的布局:
这是我的html
<section class ="page_1">
<p class="paragraph_1"> .... </p>
<p class="paragraph_2"> .... </p>
</section>
所以我尝试用打印媒体查询做一些CSS
@page {
size: 8cm 13cm; /*custom size*/
}
@media print {
section[class ^="page"] {
position: relative;
/*Same as the page size*/
width: 8cm;
height: 13cm;
display: flex;
justify-content: space-around;
flex-direction: column;
align-items: center;
page-break-after: always;
padding: 0.5cm 2cm;
}
p[class ^="paragraph"] {
/*NOTHING TO ADD FOR THE ALIGNEMENT*/
}
}
它没有按预期进行。(留下空白页,不弯曲元素)
解决方案
推荐阅读
- android - Huawei ML Kit Text to Speech 音频时长
- java - 使用 JWT 过滤器时如何正确编写 WebSecurityConfigurerAdapter?
- android - 如何在 ndk 工具链中实现 malloc_trim(0)?
- laravel - 单击部分饼图的一部分时,我有什么方法可以过滤表中的数据?拉拉维尔
- aws-sdk-js - 要求(“@aws-sdk/client-redshift-data”);失败
- swift - 如何通过命令行(对于 CI)查看 Swift 编译器警告?
- python - 我想在 discord.py 中输出多页命令
- reactjs - 从 Sanity 获取数据返回未定义(Next.js + Sanity)
- azure-cognitive-search - Azure 搜索 - 无法合并(使用技能)从 KeyPhraseExtractionSkill 获得的数据
- python - 如何使用python打印目录中缺少的日期文件夹