I'm trying to assemble an HTML page to print a label with 80mm x 40mm. It's working fine, but when the person's name is too big the label loses alignment, consuming 2 tags.
I need to lock the size of the div
, and if the text is bigger it has to be summarized and does not change the size of it.
Example of working code:
<div style="page-break-inside: avoid; width: 80mm; height: 40mm; background: #ccc;">
<!-- Nome Cliente -->
<div style="page-break-inside: avoid;">
<b>RAFAEL VILELA</b>
</div>
<!-- Endereço -->
<div style="text-align: left; font-size: 10px;">
BOA ESPERANÇA - MG<br> RUA SÃO TIAGO - 298
</div>
<!-- Volumes -->
<div style="height: 15mm; text-align: center; line-height: 15mm; font-size: 18px;">
<b>Vol.: 1 / 3</b>
</div>
<!-- Nome Cliente -->
<div style="text-align: left; font-size: 8px;">
CON. JOÃO ALGUSTO<br> 19/10/2018 - (11:20)
</div>
</div>
Now an example of how it goes misaligned with the big name.
<div style="page-break-inside: avoid; width: 80mm; height: 40mm; background: #ccc;">
<!-- Nome Cliente -->
<div style="page-break-inside: avoid;">
<b>RAFAEL VILELA FARIA BORGES DE ALMEIDA TESTE NOME GRANDE</b>
</div>
<!-- Endereço -->
<div style="text-align: left; font-size: 10px;">
BOA ESPERANÇA - MG<br> RUA SÃO TIAGO - 298
</div>
<!-- Volumes -->
<div style="height: 15mm; text-align: center; line-height: 15mm; font-size: 18px;">
<b>Vol.: 1 / 3</b>
</div>
<!-- Nome Cliente -->
<div style="text-align: left; font-size: 8px;">
CON. JOÃO ALGUSTO<br> 19/10/2018 - (11:20)
</div>
</div>