嗨,我试图隐藏一个图表从主页,并想显示它在print.But的时候,它不是我的工作。
HTML:
<div class="bar-chart">
<div class="canvas-holder3"><canvas id="resultsChart7"></canvas></div>
</div>CSS:
.bar-chart {
display: none;
}
@media print {
body,
html,
#wrapper {
width: 100%;
}
.bar-chart {
display: block;
visibility: visible;
}
}发布于 2022-02-08 08:19:29
就像这样很好。你可以遵循这个模式。
<!DOCTYPE html>
<html>
<head>
<title>Show element at print</title>
<style>
body {
text-align:center;
}
h1 {
color:green;
}
.print {
display: none;
}
@media print {
.print {
display: block;
}
}
</style>
</head>
<body>
<h1 class = "print">This section would not appear on screen but only in print.</h1>
<p>Show something during print.</p>
</body>
</html>
发布于 2022-02-08 08:10:31
您需要为此添加javascript。
https://stackoverflow.com/questions/71030309
复制相似问题