html - Chrome css 打印样式使文本重叠

标签 html css printing cross-browser

我们一直在开发一个新的日历界面,其中包括一个可打印的“经典”日历 View 。 @media print stylesheet 有很多工作要做, 而在 Safari 中一切看起来都很棒, 事件时间与 Chrome 中的事件名称重叠.想不通为什么。

@media print {
    body{
      -webkit-print-color-adjust:exact;
    }
    img,
    .calendar-nav button,
    .calendar-date-picker,
    .event .btn-group {
        display: none;
    }
    .calendar-nav {
        text-align: center;
        padding-top:20px;
    }
    .calendar-nav .date-title {
        font-size: 50px;
        font-weight: normal;
    }
    a:link:after,
    a:visited:after {
        content: "";
    }
    #calendarTable div.event {
        padding: 0;
        margin-left:0; 
        text-indent: 0;
    }
    .events.active {
        width: 100%
    }

}

enter image description here

编辑: 我通过添加 .event-location {float: none; margin-top: 0px;} 解决了重叠问题进入打印媒体查询。

另外,在 Firefox内容左侧有很大的空白:

enter image description here

很难调试这些打印样式表以弄清楚发生了什么。连Chrome开发人员工具将显示正确的打印预览,但进行实际打印时显示不正确。

关于如何解决这些问题有什么想法吗?正在使用 @media print我们的主要样式表里面有问题吗?

http://www.puc.edu/calendar?state=full

最佳答案

看起来我只需要添加一些样式来覆盖 Bootstrap 默认值:

.event-location {
    float: none !important;
    margin-top: 0px !important;
}
.event-time {
    float: none !important; 
}
body .container {
    width:100% !important;
    margin:0 !important;
}

关于html - Chrome css 打印样式使文本重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26680463/

相关文章:

javascript - 滑入一个元件,同时滑出一个元件?定位困惑?元素正在覆盖自己

html - Bootstrap 减少行填充

javascript - 单击提交按钮后如何显示 img?

带有过渡的 Javascript 可见性函数

html - 打印 css 样式表 - div 定位

html - 打印 : How to hide element and include element to print

html - Bootstrap 3 下拉菜单问题

javascript - HTML CSS 中的动画

css - 添加 SVG(通过 CSS)以适应元素的字体大小

c# - 通过 ESC/P 命令将位图写入 Epson TM88IV (Write To NVRam)