2017-07-18 4 views
1

Hier ist meine UI enter image description hereBootstrap Tabelle Einstellung

Hier ist mein Code

<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> 

Wie stelle ich das es kleiner zu machen wie folgt? enter image description here

danke

Antwort

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> 

in der Bootstrap Grid Klasse Einfach so, dass <th> und <td> Element nicht zu breit sein würde. Siehe https://www.bootply.com/BLINHddRZV für die Ausgabe.

Edit: Habe nicht gesehen, es verwendet bootstrap4. Bitte überprüfen Sie this Problem und die Antwort von mdo. Anscheinend wird die Grid-Klasse nicht mehr für die Tabelle unterstützt.

+0

Ich lege class = "col-md-2" in Teil, so dass die linke Seite schmaler ist als die rechte Seite. danke – Bmegod

+0

@ user2447944 Nur meinen Code aktualisiert. sollte 10 Einheiten aufnehmen, während 2 Einheiten breit ist. Dies sollte eine bessere Antwort als meine ursprüngliche sein. – Tim1234

+0

Ich habe den Code wie empfohlen aktualisiert. Nachrichtentyp ist breiter als . was ich will, ist entgegengesetzter weise ... – Bmegod