简体   繁体   English

将内联 css 与 DomPDF 和 Laravel 结合使用

[英]Using inline css with DomPDF and Laravel

I am having a problem with my inline css. So, I am trying to add a border under the data rendered from the database.我的内联 css 有问题。因此,我试图在从数据库呈现的数据下添加边框。 The problem is the rendered data is under the name, the How can I move the border-bottom and the rendered data at the right of the word "Name"?问题是渲染数据在名称下,如何移动边框底部和渲染数据在“名称”一词的右侧?

here's the html code这是 html 代码

<table style="border:none;border-collapse: collapse;font-size:12px;text-align: left;">
<tr>
    <td colspan="3"><b>I.  PERSONAL AND FAMILY DATA</b></td><td colspan="2"><b>Date today</b> <u>{{ \Carbon\Carbon::parse($infomodel->date_last_updated)->format('m-d-Y') }}</u></td>
</tr>
<tr >
    <td colspan="3"><b>Name </b><div style="border-bottom:.7px solid black;height:15px;padding:0px;width:290px;overflow:hidden;">{!! $usermodel->last_name !!}, {!! $usermodel->first_name!!} {!! $usermodel->middle_name !!}.
      </div>
      </td>
    <td colspan="2"><b>Sex </b><u>{!! $infomodel->gender !!}</u></td>
</tr>
<tr>
    <td colspan="5"><b>Home Address </b><div  style="border-bottom:.7px solid black;height:15px;padding:0px;width:450px;overflow:hidden;">{!! $infomodel->mailing_address !!}
        
        </div>
    </td>
</tr>
</table><br />

Here is the pdf view这是 pdf 视图

在此处输入图像描述

Print the output in the styled element.在样式元素中打印 output。 And make the element to an inline element.并使元素成为内联元素。

Example: Change this:例子:改变这个:

<td colspan="3"><b>Name </b><div style="border-bottom:.7px solid black;height:15px;padding:0px;width:290px;overflow:hidden;">{!! $usermodel->last_name !!}, {!! $usermodel->first_name!!} {!! $usermodel->middle_name !!}.
      </div>
      </td>

to this:对此:

<td colspan="3"><b>Name </b>
    <div style="display: inline; border-bottom:.7px solid black;height:15px;padding:0px;width:290px;overflow:hidden;">{!! $usermodel->last_name !!}, {!! $usermodel->first_name!!} {!! $usermodel->middle_name !!}.
    </div>
</td>

 <table style="border:none;border-collapse: collapse;font-size:12px;text-align: left;"> <tr> <td colspan="3"><b>I. PERSONAL AND FAMILY DATA</b></td><td colspan="2"><b>Date today</b> <u>{{ \Carbon\Carbon::parse($infomodel->date_last_updated)->format('md-Y') }}</u></td> </tr> <tr > <td colspan="3"><b>Name </b><div style="display: inline; border-bottom:.7px solid black;height:10px;padding:0px;width:290px;overflow:hidden;"> {,. $usermodel->last_name:.}; {:; $usermodel->first_name:;} {:; $usermodel->middle_name:;}. </div> </td> <td colspan="2"><b>Sex </b><u>{!! $infomodel->gender !!}</u></td> </tr> <tr> <td colspan="5"><b>Home Address </b>{!! $infomodel->mailing_address !!} <div style="border-bottom:.7px solid black;height:15px;padding:0px;width:450px;overflow:hidden;"> </div> </td> </tr> </table><br />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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