gpt4 book ai didi

python - 无法在 CSS 中调整图像大小

转载 作者:行者123 更新时间:2023-11-27 23:14:39 24 4
gpt4 key购买 nike

我正在通过 Flask 开发网页,并希望使用 Wea​​syPrint 生成 PDF。

我知道 flask 需要定义我的 css 文件的静态 url,并在 css 中包含 @media print。

from 
<link rel=stylesheet href="{{ url_for('static', filename='css/style.css') }}">

to

<link rel=stylesheet href="{{ url_for('static', filename='css/print.css') }}" media= "print" >

@media print {
logo{
width : 50px !important;
height : 100px !important;
object-fit: cover;
}
}

但调整后的图像并没有达到我想要的要求。

最佳答案

此命令不适用于 weasyprint,

您将需要在 Html 文件中使用 CSS。

像那样:

<style> /* use CSS into style */
@page {
size: A4; /* Change from the default size of A4 */
margin: 3.5mm; /* Set margin on each page */
}
.IMAGE{
height: 120px;
width: 120px;
margin: 0 auto;
}
</style>

再见。

关于python - 无法在 CSS 中调整图像大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58317469/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com