首页 > 解决方案 > 如何避免HTML表格顶部的空格

问题描述

我对 HTML 很陌生,我的任务是删除表格条目顶部的空格。目前,它是这样显示的。 在此处输入图像描述

我尝试了几种方法,但都没有成功。我非常感谢您对此的指导。所以它在表格数据之前显示空格。是否可以删除该空间..?这是我的样式表

<style type="text/css">
p {padding:0; margin:0}                         .container  {font-family:'Arial Unicode MS'; font-size:10px; margin:0 auto; width:100%}                 .logo-title {overflow:hidden;font-size:10px}                            .logo-title .title-txt {float:right; width:50%; padding:30px 0 0 0; font-size:10px;}                            .logo-title .logo {float:left; width:50%;}      .title{clear:both; text-align:center; font-size:18px}                                                                                           .Ts_and_Cs table {border: 1px solid #000000; border-collapse: collapse}                 .Ts_and_Cs table th {border: 1px solid #000000; background:#FFFFFF; color:#000000; text-align:center; font-size:10px}                   .Ts_and_Cs table td {border: 1px solid #000000; background:#FFFFFF; color:#000000; text-align:left; font-size:8px}                          .NoHeader {page:LastPage;page-break-before:always; page-break-inside: avoid;}#pageFooter:after {        counter-increment: page;  content: counter(page) " of "  counter(pages);}   @media print{                                                       div.header {            margin-top:50px;            position: running(header);              word-wrap: break-word;              font-color: #000000;                background:#FFFFFF;             border: 1px solid #000000;          }       div.footer{         display: block; text-align:center; font-size:9px; position:running(footer);height:50px;     }   }                                   @page {                         @top-center{ content:element(header);}                                  margin-top:650px;                                           margin-left:50px;           margin-bottom:50px;                                                                 margin-right:50px;              @bottom-center {content: element(footer);}  }           @page LastPage{                 @top-center{content: hidden;}                   margin-top:50px;                    margin-bottom:50px;                                 margin-left:50px;                                                           margin-right:50px;          @bottom-center {content: element(footer);}}</style>

我的表数据代码与标题

<table cellspacing="0" style="border:1px solid black; border-collapse:collapse; padding:10px;font-size:10px;text-align:center" width="100%">
        <tbody>
            <tr>
                <td width="10%">
                    <strong>{{$D.Work_Order.SMAX_PS_Translation__c.SMAX_PS_Quantity__c}}</strong>
                </td>
                <td width="20%">
                    <strong>{{$D.Work_Order.SMAX_PS_Translation__c.SMAX_PS_Part_Number__c}}</strong>
                </td>
                <td width="40%">
                    <strong>{{$D.Work_Order.SMAX_PS_Translation__c.SMAX_PS_Part_Description__c}}</strong>
                </td>
                <td width="10%">
                    <strong>{{$D.Work_Order.SMAX_PS_Translation__c.SMAX_PS_Base_Price__c}}</strong>
                </td>
                <td width="10%">
                    <strong>{{$D.Work_Order.SMAX_PS_Translation__c.SMAX_PS_Discount__c}}</strong>
                </td>
                <td width="10%">
                    <strong>{{$D.Work_Order.SMAX_PS_Translation__c.SMAX_PS_Total_Price__c}}</strong>
                </td>
            </tr>
        </tbody>
    </table>
</div>
<!-- table 6 end --><!-- This is the end of the header -->

<table cellpadding="0" cellspacing="0" style="border-collapse:collapse;font-size:10px;text-align:left; page-break-inside: avoid;valign:top;" svmx-data="{{$D.Parts}}" width="100%">
    <thead>
        <tr>
            <th style="text-align:left;valign:top;" svmx-data="{{$F.IF($D.Parts.SVMXC__Actual_Quantity2__c, $D.Parts.SVMXC__Actual_Quantity2__c, &quot;N/A&quot;)}}" width="10%">
            </th>
            <th style="text-align:left;valign:top;" svmx-data="{{$F.IF($D.Parts.SMAX_PS_Part_Number__c, $D.Parts.SMAX_PS_Part_Number__c, &quot;N/A&quot;)}}" width="20%">
            </th>
            <th style="text-align:left;valign:top;" svmx-data="{{$F.IF($D.Parts.SMAX_PS_Concat_Part_Work_Description__c, $D.Parts.SMAX_PS_Concat_Part_Work_Description__c, &quot;N/A&quot;)}}" width="40%">
            </th>
            <th style="text-align:left;valign:top;" svmx-data="{{$F.IF($D.Parts.SVMXC__Actual_Price2__c, $F.FORMAT(&quot;{0}&quot;, $F.LNUMBER($D.Parts.SVMXC__Actual_Price2__c,2)), &quot;N/A&quot;)}}" width="10%">
            </th>
            <th style="text-align:left;valign:top;" svmx-data="{{$F.IF($D.Parts.SMAX_PS_Calculated_Line_Discount__c, $F.FORMAT(&quot;{0}&quot;, $F.LNUMBER($D.Parts.SMAX_PS_Calculated_Line_Discount__c,2)), &quot;N/A&quot;)}}" width="10%">
            </th>
            <th style="text-align:right;valign:top;padding-right:5px" svmx-data="{{$F.IF($D.Parts.SMAX_PS_CalculatedLinePrice__c, $F.FORMAT(&quot;{0}&quot;, $F.LNUMBER($D.Parts.SMAX_PS_CalculatedLinePrice__c,2)), &quot;N/A&quot;)}}" width="10%">
            </th>
        </tr>
    </thead>
</table>

标签: javascripthtmljquerycss

解决方案


推荐阅读