如何去除两个之间的间隙

huangapple go评论58阅读模式
英文:

How to remove gap between two td

问题

如何消除两个td之间的间隙?我尝试了一些互联网上的解决方案,但都没有起作用。附上截图以供参考,可以清楚地看到问题。两个TD之间的间隙非常宽。如何减小这个间隙。

  1. class="align-middle"
  2. CELLSPACING=0
  3. row-gap: 0;
  4. class="views-field views-field-region views-align-center"
<app-header></app-header>
<section class="container">
  <div class="row" style="background-color: white;">
      <div class="col-xs-12 col-sm-8 col-md-4">
          <form action="/update/pricelist" method="POST" id="upload-file" enctype="multipart/form-data">
              <h3>导入价格表</h3>
              <hr>
              <div class="wrapper-messages">
              </div>
              <br>

              <input type="file" name="price_list" id="edit_price_list" (change)="ReadExcel($event)">
              <div class="error-msg"></div>
              <hr>
              <div class="views-exposed-widget views-submit-button">
                  <button  type="submit" class="btn btn-info form-submit icon-before submit-pricelist">
                      <span class="icon glyphicon glyphicon-ok" aria-hidden="true"></span>
                      导入
                  </button>
              </div>
              <br>
          </form>
      </div>
  </div>
</section>

<!-- 用于Excel的表格 -->

<div class="main-container container-fluid">
  <div class="row">
    <section id="block-views-exp-land-page" class="block block-views clearfix">
      <form autocomplete="off" action="" method="post" id="views-exposed-form-land-page" accept-charset="UTF-8">
        <div>
          <section id="block-system-main" class="block block-system clearfix">
            <div class="view view-land view-id-land view-display-id-page table-checkbox-all view-dom-id-8d32f83bab6c36c396b926a7c7c35f7f">
            </div>
            <div class="view-content">
              <div class="table-responsive col-10 row align-items-center col-md-12">
                <table class="views-table cols-16 table table-hover table-0 table-0 table-0 neilsoft-region-table">
                  <thead class="neilsoft-region-table-head">
                    <tr>
                      <th class="views-field views-field-region views-align-center">
                        <a href="#" title="按区域排序" class="active" name="autodeskm">Autodesk材料描述</a>
                      </th>
                      <th class="views-field views-field-php-4 views-align-center">
                        <a href="#" title="按Autodesk SAP材料描述排序" class="active">Autodesk SAP材料描述</a>
                      </th>
                      <th class="views-field views-field-php-2 views-align-center">
                        <a href="#" title="按产品来源排序" class="active">产品来源</a>
                      </th>
                      <th class="views-field views-field-php-2 views-align-center">
                        <a href="#" title="按媒体排序" class="active">媒体</a>
                      </th>
                    </tr>
                  </thead>
                </table>
              </div>
            </div>

            <div class="view-content">
                <div class="table-responsive col-10 row align-items-center col-md-12">
                  <table class="views-table cols-16 table table-hover table-0 table-0 table-0 neilsoft-region-table">
                    <thead class="neilsoft-region-table-head">
                        <tr *ngFor="let pricedata of ExcelData" class="align-middle">
                            <td>
                                {{pricedata.Autodesk_Material_Description}}
                            </td>
                            <td>
                                {{pricedata.Autodesk_SAP_Material_Description}}
                            </td>
                            <td>
                                {{pricedata.Product_Coming_From}}
                            </td>
                            <td>
                                {{pricedata.Media}}
                            </td>  
                        </tr>
                    </thead>
                  </table>
                </div>
            </div>
          </section>
        </div>
      </form>
    </section>
  </div>
</div>

<app-footer></app-footer>

图像描述
1: https://i.stack.imgur.com/utk8y.jpg

英文:

How to remove gap between two td ? I have tried some below solutions
from the Internet but none of them work. Attached the screenshot for
reference too. It will give clear idea of problem. The gap between two TD is very wide. How to reduce this Gap.

>
> 1. class="align-middle"
> 2. CELLSPACING=0
> 3. row-gap: 0;
> 4. class="views-field views-field-region views-align-center"

&lt;app-header&gt;&lt;/app-header&gt;
&lt;section class=&quot;container&quot;&gt;
&lt;div class=&quot;row&quot; style=&quot;background-color: white;&quot;&gt;
&lt;div class=&quot;col-xs-12 col-sm-8 col-md-4&quot; &gt;
&lt;form action=&quot;/update/pricelist&quot; method=&quot;POST&quot; id=&quot;upload-file&quot; enctype=&quot;multipart/form-data&quot;&gt;
&lt;h3&gt;Import Pricelist&lt;/h3&gt;
&lt;hr&gt;
&lt;div class=&quot;wrapper-messages&quot;&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;input type=&quot;file&quot; name=&quot;price_list&quot; id=&quot;edit_price_list&quot; (change)=&quot;ReadExcel($event)&quot;&gt;
&lt;div class=&quot;error-msg&quot;&gt;&lt;/div&gt;
&lt;hr&gt;
&lt;div class=&quot;views-exposed-widget views-submit-button&quot;&gt;
&lt;button  type=&quot;submit&quot; class=&quot;btn btn-info form-submit icon-before submit-pricelist&quot;&gt;
&lt;span class=&quot;icon glyphicon glyphicon-ok&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;
Import
&lt;/button&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;/form&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/section&gt;
&lt;!-- Table for excel --&gt;
&lt;div class=&quot;main-container container-fluid&quot;&gt;
&lt;div class=&quot;row&quot;&gt;
&lt;section id=&quot;block-views-exp-land-page&quot; class=&quot;block block-views clearfix&quot;&gt;
&lt;form autocomplete=&quot;off&quot; action=&quot;&quot; method=&quot;post&quot; id=&quot;views-exposed-form-land-page&quot; accept-charset=&quot;UTF-8&quot;&gt;
&lt;div&gt;
&lt;section id=&quot;block-system-main&quot; class=&quot;block block-system clearfix&quot;&gt;
&lt;div
class=&quot;view view-land view-id-land view-display-id-page table-checkbox-all view-dom-id-8d32f83bab6c36c396b926a7c7c35f7f&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;view-content&quot;&gt;
&lt;div class=&quot;table-responsive&quot; class=&quot;col-10&quot; class=&quot;row align-items-center&quot; class=&quot;col-md-12&quot;&gt;
&lt;table class=&quot;views-table cols-16 table table-hover table-0 table-0 table-0 neilsoft-region-table&quot;&gt;
&lt;thead class=&quot;neilsoft-region-table-head&quot;&gt;
&lt;tr&gt;
&lt;th class=&quot;views-field views-field-region views-align-center&quot;&gt;
&lt;a href=&quot;#&quot; title=&quot;sort by Region&quot; class=&quot;active&quot; name=&quot;autodeskm&quot;&gt;Autodesk Material Description&lt;/a&gt;
&lt;/th&gt;
&lt;th class=&quot;views-field views-field-php-4 views-align-center&quot;&gt;
&lt;a href=&quot;#&quot; title=&quot;sort by Autodesk SAP Material Description&quot; class=&quot;active&quot;&gt;Autodesk SAP Material Description&lt;/a&gt;
&lt;/th&gt;
&lt;th class=&quot;views-field views-field-php-2 views-align-center&quot;&gt;
&lt;a href=&quot;#&quot; title=&quot;sort by Product Coming From&quot; class=&quot;active&quot;&gt;Product Coming From&lt;/a&gt;
&lt;/th&gt;
&lt;th class=&quot;views-field views-field-php-2 views-align-center&quot;&gt;
&lt;a href=&quot;#&quot; title=&quot;sort by Media&quot; class=&quot;active&quot;&gt;Media&lt;/a&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;view-content&quot;&gt;
&lt;div class=&quot;table-responsive&quot; class=&quot;col-10&quot; class=&quot;row align-items-center&quot; class=&quot;col-md-12&quot;&gt;
&lt;table class=&quot;views-table cols-16 table table-hover table-0 table-0 table-0 neilsoft-region-table&quot;&gt;
&lt;thead class=&quot;neilsoft-region-table-head&quot;&gt;
&lt;tr *ngFor=&quot;let pricedata of ExcelData&quot; class=&quot;align-middle&quot;&gt;
&lt;td&gt;
{{pricedata.Autodesk_Material_Description}}
&lt;/td&gt;
&lt;td&gt;
{{pricedata.Autodesk_SAP_Material_Description}}
&lt;/td&gt;
&lt;td&gt;
{{pricedata.Product_Coming_From}}
&lt;/td&gt;
&lt;td&gt;
{{pricedata.Media}}
&lt;/td&gt;  
&lt;/tr&gt;
&lt;/thead&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/section&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/section&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;app-footer&gt;&lt;/app-footer&gt;[enter image description here][1]

答案1

得分: 0

也许 border-collapse: collapse; 是你缺少的部分?

td {
  background: red;
  color: white;
  padding: 0.5em;
}

.t1 {
  margin-top: 2em;
  border-collapse: collapse;
}
<table>
  <tr><td>1</td><td>2</td><td>3</td></tr>
  <tr><td>4</td><td>5</td><td>6</td></tr>
</table>

<table class="t1">
  <tr><td>1</td><td>2</td><td>3</td></tr>
  <tr><td>4</td><td>5</td><td>6</td></tr>
</table>
英文:

Perhaps border-collapse: collapse; is what you’re missing?

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-css -->

td {
background: red;
color: white;
padding: 0.5em;
}
.t1 {
margin-top: 2em;
border-collapse: collapse;
}

<!-- language: lang-html -->

&lt;table&gt;
&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;6&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;table class=&quot;t1&quot;&gt;
&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;6&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

<!-- end snippet -->

答案2

得分: 0

我建议您查看HTML表格中的colspan(https://html.com/tables/rowspan-colspan/)。使用colspan,您可以合并两个td单元格。请查看以下示例:

<!-- language: lang-html -->

<table border="1">
 <tr>
  <td colspan="2">合并单元格</td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
 </tr>
</table>

这段代码演示了如何使用colspan合并单元格。

英文:

I suggest you looking for html table colspan (https://html.com/tables/rowspan-colspan/). With colspan you can merge two td cells. Take a look in the example below:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-css -->

td {
width: 30px;
}

<!-- language: lang-html -->

&lt;table border=&quot;1&quot;&gt;
&lt;tr&gt;
&lt;td colspan=&quot;2&quot;&gt;Merged&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

<!-- end snippet -->

huangapple
  • 本文由 发表于 2023年2月8日 13:29:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75381685.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定