I am facing a problem when i try to add the margin-top or margin-bottom on div elements inside a table for generating pdf with mpdf.
I have something like this:
<table>
<tr>
<td>
<div style="margin-top: 20px;">Element1</div>
<div style="margin-top: 20px;">Element2</div>
...
</td>
<td>
<div style="margin-top: 20px;">Element4</div>
<div style="margin-top: 20px;">Element5</div>
...
</td>
</tr>
</table>
The margin styles are not converted.
I think it could be because there are too many nested elements and mpdf doesnt support them in some cases. Have someone already achieved such a problem?
Finally i have found another way to achieve this without using margin style.
I have just used the simple tag <br>
to create space between my elements.
<table>
<tr>
<td>
<br><br>
<div>Element1</div>
<br><br>
<div>Element2</div>
...
</td>
<td>
<br><br>
<div>Element4</div>
<br><br>
<div>Element5</div>
...
</td>
</tr>
</table>
Mpdf has some limitations in CSS. Sometimes to achieve some tasks we have to think another way. Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With