18 - table : tabla condensada

Si tenemos que mostrar grandes tablas con datos puede ser necesario mostrar más información al mismo tiempo por pantalla condensando los datos (son los mismos datos pero más comprimidos en pantalla)

Esto se logra agregando la clase "table-sm" a la marca HTML "table".

Veamos un ejemplo con una tabla común y una tabla condensada:

<!doctype html>
<html>
<head>
  <title>Prueba de Bootstrap 4</title> 
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
  <div class="container">
    <table class="table">
      <thead> 
        <tr> 
          <th>Titulo 1</th> 
          <th>Titulo 2</th>
          <th>Titulo 3</th>
        </tr> 
      </thead>
        <tr> 
          <td>Elemento 1,1</td>
          <td>Elemento 1,2</td> 
          <td>Elemento 1,3</td> 
        </tr>
        <tr> 
          <td>Elemento 2,1</td>
          <td>Elemento 2,2</td> 
          <td>Elemento 2,3</td> 
        </tr>
        <tr> 
          <td>Elemento 3,1</td>
          <td>Elemento 3,2</td> 
          <td>Elemento 3,3</td> 
        </tr>
        <tr> 
          <td>Elemento 4,1</td>
          <td>Elemento 4,2</td> 
          <td>Elemento 4,3</td> 
        </tr>
        <tr> 
          <td>Elemento 5,1</td>
          <td>Elemento 5,2</td> 
          <td>Elemento 5,3</td> 
        </tr>
    </table>

    <table class="table table-sm">
      <thead> 
        <tr> 
          <th>Titulo 1</th> 
          <th>Titulo 2</th>
          <th>Titulo 3</th>
        </tr> 
      </thead>
        <tr> 
          <td>Elemento 1,1</td>
          <td>Elemento 1,2</td> 
          <td>Elemento 1,3</td> 
        </tr>
        <tr> 
          <td>Elemento 2,1</td>
          <td>Elemento 2,2</td> 
          <td>Elemento 2,3</td> 
        </tr>
        <tr> 
          <td>Elemento 3,1</td>
          <td>Elemento 3,2</td> 
          <td>Elemento 3,3</td> 
        </tr>
        <tr> 
          <td>Elemento 4,1</td>
          <td>Elemento 4,2</td> 
          <td>Elemento 4,3</td> 
        </tr>
        <tr> 
          <td>Elemento 5,1</td>
          <td>Elemento 5,2</td> 
          <td>Elemento 5,3</td> 
        </tr>
    </table>

 </div> 
</body>
</html>

A la tabla que queremos condensar debemos agregarle la clase "table-sm":

    <table class="table table-sm">

Podemos ver la diferencia entre una tabla por defecto y una condensada:

bootstrap 4 table table-sm

Ejecutar Ejemplo

Retornar