简体   繁体   中英

CSS margin & padding not working

When I convert html to PDF margin & padding are not applied in PDF.

 <tr> <td> <img src="2.jpg" alt="" title="" style="width:40px; height:40px;margin-top: -23px; margin-left: -6px;"> </td> <td width="85%" valign="bottom"> <font size="4" face="Arial"><b>Happy to help</b></font> <hr> </td> </tr> 

Also, how to reduce height of hr element?

hr屏幕截图

带有hr截图的pdf

 .styleHr{ border-top: 0px solid #8c8b8b; } 
 <tr> <td> <img src="2.jpg" alt="" title="" style="width:40px; height:40px;margin-top: -23px; margin-left: -6px;"> </td> <td width="85%" valign="bottom"> <font size="4" face="Arial"><b>Happy to help</b></font> <hr class="styleHr"> </td> </tr> 

Use a class to hr and apply styles for that class.

Please try this and let me know

<tr>
        <td style="display: block;">
            <img src="2.jpg" alt="" title="" style="display: block; width:40px; height:40px; margin-top: 23px; margin-left: 6px;">
        </td>
        <td width="85%" valign="bottom">
            <font size="4" face="Arial"><b>Happy to help</b></font>
            <hr>
        </td>
    </tr>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM