gpt4 book ai didi

html - 打印 html 页面时隐藏进度条

转载 作者:太空宇宙 更新时间:2023-11-04 06:11:30 25 4
gpt4 key购买 nike

我正在做一个必须使用进度条的元素,最后我必须简单地打印该页面。但问题是每当我打印/或另存为 pdf 时,使用 ctrl+p 命令进度条的页面在打印/PDF 文档中变得不可见。

我使用的是非常简单的示例,可以在 w3schools.com 上找到。我也提供了代码

<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
<h2 style="color:red">Colored Progress Bars</h2>

<!-- Blue -->
<div class="progress">
<div class="progress-bar" style="width:10%"></div>
</div><br>

<!-- Green -->
<div class="progress">
<div class="progress-bar bg-success" style="width:20%"></div>
</div><br>
</div>

</body>
</html>

最佳答案

希望对你有帮助

@media print {
.progress {
position: relative;
}
.progress:before {
display: block;
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 0;
border-bottom: 2rem solid #eeeeee;
}
.progress-bar {
position: absolute;
top: 0;
bottom: 0;
left: 0;
z-index: 1;
border-bottom: 2rem solid #337ab7;
}
.bg-success {
border-bottom-color: #67c600;
}
.bg-info {
border-bottom-color: #5bc0de;
}
.bg-warning {
border-bottom-color: #f0a839;
}
.bg-danger {
border-bottom-color: #ee2f31;
}
}

我的引用资料> Bootstrap - progress-bar is not shown in print preview

关于html - 打印 html 页面时隐藏进度条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56372491/

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