Bootstrap Tablas
Introducción
En este tutorial, aprenderá a usar el kit de herramientas Bootstrap para crear tablas.
Explicación
En bootstrap.css de la versión 2.0 de Bootstrap, las líneas 1034 a 1167 incluyen los estilos de tabla.
Como usted sabe, las tablas solo se utilizan para presentar datos tabulares. Con Bootstrap es igual: la posición del marcado debe ser como se muestra a continuación:
Si utiliza encabezados de columna, la jerarquía debe ser como se muestra a continuación:
Ejemplo de tabla simple de Bootstrap
Ejemplo
<table class="table">
<thead>
<tr>
<th>Student-ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Grade</th>
</tr>
</thead>
<tbody>
<tr>
<td>001</td>
<td>Rammohan </td>
<td>Reddy</td>
<td>A+</td>
</tr>
<tr>
<td>002</td>
<td>Smita</td>
<td>Pallod</td>
<td>A</td>
</tr>
<tr>
<td>003</td>
<td>Rabindranath</td>
<td>Sen</td>
<td>A+</td>
</tr>
</tbody>
</table>
<thead>
<tr>
<th>Student-ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Grade</th>
</tr>
</thead>
<tbody>
<tr>
<td>001</td>
<td>Rammohan </td>
<td>Reddy</td>
<td>A+</td>
</tr>
<tr>
<td>002</td>
<td>Smita</td>
<td>Pallod</td>
<td>A</td>
</tr>
<tr>
<td>003</td>
<td>Rabindranath</td>
<td>Sen</td>
<td>A+</td>
</tr>
</tbody>
</table>
Salida

Ver en línea
Ejemplo de tabla cebra de Bootstrap
Esta tabla utiliza la clase CSS de rayas de cebra, definida en el archivo CSS de Bootstrap; el nombre de la clase es .table-striped.
Ejemplo
<table class="table table-striped">
<thead>
<tr>
<th>Student-ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Grade</th>
</tr>
</thead>
<tbody>
<tr>
<td>001</td>
<td>Rammohan </td>
<td>Reddy</td>
<td>A+</td>
</tr>
<tr>
<td>002</td>
<td>Smita</td>
<td>Pallod</td>
<td>A</td>
</tr>
<tr>
<td>003</td>
<td>Rabindranath</td>
<td>Sen</td>
<td>A+</td>
</tr>
</tbody>
</table>
<thead>
<tr>
<th>Student-ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Grade</th>
</tr>
</thead>
<tbody>
<tr>
<td>001</td>
<td>Rammohan </td>
<td>Reddy</td>
<td>A+</td>
</tr>
<tr>
<td>002</td>
<td>Smita</td>
<td>Pallod</td>
<td>A</td>
</tr>
<tr>
<td>003</td>
<td>Rabindranath</td>
<td>Sen</td>
<td>A+</td>
</tr>
</tbody>
</table>
Salida

Ver en línea
Vea el ejemplo anterior en diferentes ventanas del navegador.
Haga clic aquí para descargar todos los archivos HTML, CSS, JS e imágenes utilizados en este tutorial.
Otras extensiones