2015-02-19 13 views
16

Non ho visto alcun esempio durante la ricerca su google. Ho provato a rendere thead mobile a sinistra e tbody a destra, ma non ha funzionato. Come avere un'intestazione di tabella sul lato sinistro invece di mostrarlo in alto?intestazione della tabella sul lato sinistro in Bootstrap?

<table class="table"> 
    <thead> 
     <tr> 
      <th>Row</th> 
      <th>First Name</th> 
      <th>Last Name</th> 
      <th>Email</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <td>1</td> 
      <td>John</td> 
      <td>Carter</td> 
      <td>[email protected]</td> 
     </tr> 
     <tr> 
      <td>2</td> 
      <td>Peter</td> 
      <td>Parker</td> 
      <td>[email protected]</td> 
     </tr> 
     <tr> 
      <td>3</td> 
      <td>John</td> 
      <td>Rambo</td> 
      <td>[email protected]</td> 
     </tr> 
    </tbody> 
</table> 

risposta

57

Se si desidera che le intestazioni lungo il lato sinistro della tabella, è sufficiente scrivere il markup in modo diverso:

<table class="table"> 
    <tbody> 
     <tr> 
      <th>Row</th> 
      <td>1</td> 
      <td>2</td> 
      <td>3</td> 
     </tr> 
     <tr> 
      <th>First Name</th> 
      <td>John</td> 
      <td>Peter</td> 
      <td>John</td> 
     </tr> 
     <tr> 
      <th>Last Name</th> 
      <td>Carter</td> 
      <td>Parker</td> 
      <td>Rambo</td> 
     </tr> 
     <tr> 
      <th>Email</th> 
      <td>[email protected]</td> 
      <td>[email protected]</td> 
      <td>[email protected]</td> 
     </tr> 
    </tbody> 
</table> 

Vedi this demo

Problemi correlati