2017-07-18 33 views
1

這裏是我的UI enter image description here舉表調整

這裏是我的代碼

<div class="container"> 
    <table id="headerTable" class="table table-bordered "> 
    <thead class="thead-default"> 
     <tr> 
     <th colspan="2">電文Header</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <th>Filler1</th> 
      <td><input id="123" type="text" class="input-sm"></td> 
     </tr> 
     <tr> 
      <th>MessageType</th> 
      <td><input id="123" type="text" class="input-sm"></td> 
     </tr> 
     <tr> 
      <th>MessageLength</th> 
      <td><input id="123" type="text" class="input-sm"></td> 
     </tr> 
    </tbody> 
    </table> 
</div> 

如何調整,使之更小的像下面? enter image description here

謝謝

回答

1
<div class="container"> 
<table id="headerTable" class="table table-bordered "> 
    <thead class="thead-default"> 
     <tr> 
      <th colspan="2">電文Header</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <th class="col-sm-1">Filler1</th> 
      <td class="col-sm-11"> 
       <input id="123" type="text" class="input-sm"> 
      </td> 
     </tr>    
     <tr> 
      <th class="col-sm-1">MessageType</th> 
      <td class="col-sm-11"> 
       <input type="text" class="input-sm"> 
      </td> 
     </tr> 
     <tr> 
      <th class="col-sm-1">MessageLength</th> 
      <td class="col-sm-11"> 
       <input type="text" class="input-sm"> 
      </td> 
     </tr> 
    </tbody> 
</table> 

只要把在Bootstrap Grid類,以便<th><td>元素不會太寬。 請參閱https://www.bootply.com/BLINHddRZV輸出。

編輯:沒有看到它使用bootstrap4。請檢查this問題和mdo的回覆。顯然,網格類不再支持表格。

+0

我把class =「col-md-2」放在​​部分,所以左邊比右邊窄。謝謝 – Bmegod

+0

@ user2447944剛剛更新了我的代碼。​​應占用10個單位,而則增加2個單位。這應該是比我原來的更好的答案。 – Tim1234

+0

我按照你的建議更新了代碼。 MessageType比寬。我想要的是相反的方式... – Bmegod