2017-03-31 41 views
0

我做了一個簡單的演示,我有幾個員工信息。我正在使用物化CSS表。但是我在sr.no和其他列名之間獲得了額外的空間。Materialise CSS刪除表頭間距

My table image with doubt

這裏是我的代碼:

 <br/> 

    <div class="row"> 
    <div class="col l8"> 
     <div class="card darken-2"> 
       <div class="card-content"> 
        <span class="card-title">{{tableTitle}}</span> 
        <br/> 
        <div class="row"> 
         <div class="input-field col s4"> 
           <input id="empSearch" type="text" placeholder="Search"> 

          </div> 
        </div> 
        <br/> 
        <div class="row"> 
          <div class="col lg7"> 
           <table class="bordered highlight responsive-table"> 
             <thead> 
              <tr> 
                <th>Sr.no</th> 
                <th>Name</th> 
                <th>Age</th> 
                <th>Gender</th> 
                <th>Address</th> 
                <th>Designation</th> 
                <th>Department</th> 
                <th>Salary</th> 
                <th></th> 
                <th></th> 

              </tr> 
             </thead> 
             <tbody> 
              <tr *ngFor="let item of EmployeeData;let i= index"> 
                <td>{{i+1}}</td> 
                <td>{{item.Name}}</td> 
                <td>{{item.Age}}</td> 
                <td>{{item.Gender}}</td> 
                <td>{{item.Address}}</td> 
                <td>{{item.Designation}}</td> 
                <td>{{item.Department}}</td> 
                <td>{{item.Salary}}</td> 
                <td> 
                 <i class="material-icons">delete</i> 
                </td> 
                <td> 
                 <i class="material-icons">mode_edit</i> 
                </td>              
              </tr> 
             </tbody> 

           </table> 
          </div> 
        </div> 
       </div> 
     </div> 
    </div> 

+0

不知道是否Materialise的具體提供這個東西,但通常你剛纔設置的CSS'width'的您的列標題(或定義HTML中的實際列)。 – Mario

回答

0

<th>你可以設置width="30px"或任何your're舒服。 的圖標,我把一個單元格,並使用text-align: right

<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/css/materialize.min.css" rel="stylesheet" /> 
 
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> 
 
<table> 
 
    <thead> 
 
    <tr> 
 
     <th width="30px">Sr.no</th> 
 
     <th>Name</th> 
 
     <th>Age</th> 
 
     <th>Gender</th> 
 
     <th>Address</th> 
 
     <th>Designation</th> 
 
     <th>Department</th> 
 
     <th>Salary</th> 
 
     <th></th> 
 

 
    </tr> 
 
    </thead> 
 
    <tbody> 
 
    <tr> 
 
     <td>{{i+1}}</td> 
 
     <td>{{item.Name}}</td> 
 
     <td>{{item.Age}}</td> 
 
     <td>{{item.Gender}}</td> 
 
     <td>{{item.Address}}</td> 
 
     <td>{{item.Designation}}</td> 
 
     <td>{{item.Department}}</td> 
 
     <td>{{item.Salary}}</td> 
 
     <td style="text-align: right"> 
 
     <i class="material-icons">delete</i> 
 
     <i class="material-icons">mode_edit</i> 
 
     </td> 
 
    </tr> 
 
    </tbody> 
 

 
</table>