【问题标题】:Use active class, on table. Using Bootstrap and printThis在桌子上使用活动课程。使用 Bootstrap 和 printThis
【发布时间】:2015-08-01 19:30:51
【问题描述】:

我使用 Bootstrap 作为我的框架。
要打印部分页面,我使用“printThis”jquery 插件。

当我打印表格时,活动类不会显示。
活动被填充的行(单元格)。

我该如何解决这个问题?

HTML/php

if($day == "Mån"){
  $mark_monday = "active";
}

echo "<tr class='print_table_text ".$mark_monday."'>";

更新 CSS
我试过了,打印出来的只有粗体字!?
我可以在网页上看到引导程序添加的“活动”类。但它没有显示在印刷品中。

.print_table_text {
  font-size: 10px;
}
.print_table_text.active {
  font-weight: bold;
  background-color: #000000;
}

打印此

<script>
  $(document).ready(function () {
    $('#print_btn').click(function () {
        loadCSS: "css/printthis-print_all_usrs_time.css"
        $('#usr_name, #list_usr_time, #sum_worked_time, #break_page').printThis();
    });
});
</script>

更新

我确实删除了引导类“活动”。并创建了一个自己的类,称为灰色。我使用样式表添加背景颜色灰色。但同样的问题也随之而来。我可以在浏览器中看到灰色背景,但在打印件上看不到。

$mark_monday = "bggrey";

.print_table_text.bggrey {
  font-weight: bold;
  background-color: #f5f5f5;
}

粗体属性在印刷品上,但不是 BG 颜色。

【问题讨论】:

  • 请发布您用于启动 printThis 功能的代码。
  • 粗体属性有效并显示在打印件上。但是,来自 Bootstrap 的“活动”类将表格行设为灰色,并没有显示在打印件上。

标签: twitter-bootstrap printthis


【解决方案1】:

将此媒体查询添加到将应用于打印的样式中

@media print {
    td.active {
        background-color: #f5f5f5;
    }
}

【讨论】:

  • 这才是正确的方法(我是printThis作者)。
  • @Jason 谢谢。我不太擅长 CSS。但我试过这个例子没有成功。我也用一半工作的css更新了我的问题。显示了奇怪的“粗体”,但没有显示“背景颜色”。
  • 我尝试将 td.active 更改为 tr.active 没有成功。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-02-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-09-28
  • 1970-01-01
相关资源
最近更新 更多