您的位置:首页 > Web前端 > BootStrap

Bootstrap 3.x 打印问题 打印无法显示背景、字体变黑

2017-12-13 15:52 411 查看
这万恶的东西,打印也要你写样式啊!真是坑。

Bootstrap 以下代码设置了打印样式,改下就好了

@media print {

  * {

    color: #000 !important;

    text-shadow: none !important;

    background: transparent !important;

    box-shadow: none !important;

  }

  a,

  a:visited {

    text-decoration: underline;

  }

  a[href]:after {

    content: " (" attr(href) ")";

  }

  abbr[title]:after {

    content: " (" attr(title) ")";

  }

  a[href^="javascript:"]:after,

  a[href^="#"]:after {

    content: "";

  }

  pre,

  blockquote {

    border: 1px solid #999;

    page-break-inside: avoid;

  }

  thead {

    display: table-header-group;

  }

  tr,

  img {

    page-break-inside: avoid;

  }

  img {

    max-width: 100% !important;

  }

  p,

  h2,

  h3 {

    orphans: 3;

    widows: 3;

  }

  h2,

  h3 {

    page-break-after: avoid;

  }

  select {

    background: #fff !important;

  }

  .navbar {

    display: none;

  }

  .table td,

  .table th {

    background-color: #fff !important;

  }

  .btn > .caret,

  .dropup > .btn > .caret {

    border-top-color: #000 !important;

  }

  .label {

    border: 1px solid #000;

  }

  .table {

    border-collapse: collapse !important;

  }

  .table-bordered th,

  .table-bordered td {

    border: 1px solid #ddd !important;

  }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  bootstrap html