0
I have a table with a background image and I would like to somehow set the size of this table so that the image appears completely.
So far it needs to contain data in the table, but when it has little data it cuts and, depending on the amount, it doesn’t even show. Then there would be some way, regardless of the amount of data, it would show the size of the image?
table {
page-break-inside: auto;
width: 100%;
}
tr {
page-break-inside: avoid;
page-break-after: auto
}
thead {
display: table-header-group
}
<table style='background-image:url(http://lorempixel.com/output/city-q-g-600-400-3.jpg);'>
<thead>
<tr>
<td colspan='2'>
<div style="width:100%;height:90px;"></div>
</td>
</tr>
</thead>
<tr class="linhas">
<td style="width:50%;">Dados 1</td>
<td style="width:50%;">Importante: aadadagdsgsagsa</td>
</tr>
<tr class="linhas">
<td style="width:50%;">Dados 2</td>
<td style="width:50%;">Importante: aadadagdsgsagsa</td>
</tr>
<tr class="linhas">
<td style="width:50%;">Dados 3</td>
<td style="width:50%;">Importante: aadadagdsgsagsa</td>
</tr>
<tr class="linhas">
<td style="width:50%;">Dados 4</td>
<td style="width:50%;">Importante: aadadagdsgsagsa</td>
</tr>
<tr class="linhas">
<td style="width:50%;">Dados 5</td>
<td style="width:50%;">Importante: aadadagdsgsagsa</td>
</tr>
</table>
I added a border for him to view better.
– Leonardo Bonetti
@Leonardobonetti thank you :)
– Sergio
@Sergio Cara looks at an example of the code https://jsfiddle.net/VitorBueno/ow9jvqx1/9/ This seeing that I put the height: 400px; but let’s say that it is only 50 or 100, ends up cutting the background image, I want it to be printed the size of the background sheet, not that the image itself fits to fit in the table size
– Vitor Bueno
I put the background image of the table, because sometimes the data goes from more than one page, and so replicates the image to next page, and my problem is just this, when jumps page and does not have enough data to show the full background image, and also when you only have one page and don’t have enough data to show the full background image
– Vitor Bueno