0
對於僅包含圖像的HTML文檔,如何縮放圖像以填充整張圖紙? 我希望圖像根據需要按比例調整寬度/高度,使其儘可能大/小,以適合一張紙。如何以最大尺寸打印每張(紙張)1張圖像
我開始使用此爲分頁符
footer {page-break-after:always;}
我不知道從哪裏開始的高度/寬度圖像?
想法?
對於僅包含圖像的HTML文檔,如何縮放圖像以填充整張圖紙? 我希望圖像根據需要按比例調整寬度/高度,使其儘可能大/小,以適合一張紙。如何以最大尺寸打印每張(紙張)1張圖像
我開始使用此爲分頁符
footer {page-break-after:always;}
我不知道從哪裏開始的高度/寬度圖像?
想法?
HTML
<img class="printThisFull" src="http://placehold.it/350x150" alt="Klematis" width="110" height="90">
<img class="printThisFull" src="http://placehold.it/350x150" alt="Klematis" width="110" height="90">
如果你想如果你想圖像全幅保持寬高比
@media print {
.printThisFull {
width:100%;
height:auto;
page-break-after:always
}
}
如果你伸展圖像以整版區域
@media print {
.printThisFull {
width:100%;
height:100%;
page-break-after:always
}
}
想要保持高寬比爲全頁面高度的圖像
@media print {
.printThisFull {
width:auto;
height:100%;
page-break-after:always
}
}
你可以試試這個
使下面的代碼新的HTML文件,並在瀏覽器中,按CRT + P啓動它,你會看到它的工作。
<!doctype html>
<body>
<img class="printThisFull" src="http://placehold.it/350x150" alt="Klematis" width="110" height="90">
<img class="printThisFull" src="http://placehold.it/350x150" alt="Klematis" width="110" height="90">
<style>
@media print {
.printThisFull {
width:100%;
height:auto;
page-break-after:always
}
}
</style>
</body>
</html>