打印文檔添加水印

**

React 打印添加水印css樣式。

**

@media screen {
  .printer {
    display: none;
  }
}

@media print {
/*隱藏app*/
  #app {
    visibility: hidden;
    display: unset;
    padding: 0px !important;
  }
   .ms-Viewport {
    display: none;
  } 
  /*系統打印*/
  .printer {
    font-family: sans-serif;
    width: 95%;
    top: 0px;
    left: 0px;
    z-index: 9999;
    position: absolute;
    visibility: visible;
    line-height: 0.5cm;
  }
    .printer .label{
    padding: 0mm !important;
  } 
   .printer .label+.label {
    page-break-before: always;
    page-break-inside: avoid;
    page-break-after: always;
  }  
  tbody:before {
    content: "我是水印";
    font-family: serif;
    font-size: 10rem;/*字體大小*/
    /* position: absolute; */
    transform:rotate(-40deg); /*傾斜角度*/
    top: 25rem;  /*上邊距*/
    left: 5rem;/*左邊距*/
    z-index: 0;
    line-height: 2;
    color: rgba(50, 25, 0, 0.09);
    position:fixed; /*每一頁都有水印*/
    /* pointer-events:none; */
}
}
上一篇:弹性盒布局CSS3


下一篇:HTML表格