If I use Bootstrap table
class on a table, print preview doesn't show background color for tr
.
My code
@media print {
.bg-danger {
background-color: #f2dede !important;
}
}
<body>
<div class="bg-danger">
<td>DIV</td>
</div>
<table class="table">
<tr class="bg-danger">
<td>TR 1</td>
</tr>
<tr class="danger">
<td>TR 2</td>
</tr>
<tr style="background-color: #f2dede !important;">
<td>TR 3</td>
</tr>
</table>
</body>
On screen, all is red but on print preview only the div
element is red.
If I remove the table
class, everything works (except I need table style).
My configuration : IE11 and Windows 7.
Is there a trick to print the background color ?
Note: The indicated duplicate (CSS @media print issues with background-color;) is not the issue here, my settings are checked to print background colors. Also, I can print color for several other elements.
Answer :
Thanks to @Ted comments, I overrided td
style for table
class :
<style type="text/css">
@media print {
.bg-danger {
background-color: #f2dede !important;
}
.table td {
background-color: transparent !important;
}
}
</style>