Css 打印预览中不显示背景图像

Css 打印预览中不显示背景图像,css,Css,我使用的是Laravel5.4,但不是在打印预览中显示。 怎么办 .bg { @media print { visibility: visible; /* The image used */ background-image: url("../logo/back_id_card.JPG"); /* Full height */ height: 100%; /* Center and scale the image nicely */ b

我使用的是Laravel5.4,但不是在打印预览中显示。 怎么办

.bg {
  @media print {
    visibility: visible;
    /* The image used */
    background-image: url("../logo/back_id_card.JPG");
    /* Full height */
    height: 100%;
    /* Center and scale the image nicely */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    -webkit-print-color-adjust: exact;
  }
}

请尝试此操作以查看问题是否仍然存在(适用于所有元素*):

-webkit print color adjust属性是一个非标准CSS扩展,可用于在基于webkit引擎的浏览器中强制打印背景色和图像。

我认为您的代码是错误的:

这应该是:

像这样:

.bg
应该在
@媒体打印
中,而不是相反


希望这对您有所帮助。

如果任何答案对您无效,请添加
!重要信息
遵循css规则,如
背景图像:url(“../logo/back\u id\u card.JPG”)!重要的和预览,它肯定会工作。
@media print {
    * {
        -webkit-print-color-adjust: exact;
    }
}
.bg {
  @media print {
    visibility: visible;
    /* The image used */
    background-image: url("../logo/back_id_card.JPG");
    /* Full height */
    height: 100%;
    /* Center and scale the image nicely */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    -webkit-print-color-adjust: exact;
  }
}
@media print {
 .bg {
    visibility: visible;
    /* The image used */
    background-image: url("../logo/back_id_card.JPG");
    /* Full height */
    height: 100%;
    /* Center and scale the image nicely */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    -webkit-print-color-adjust: exact;
   }
}