bootstrap4 table
时间: 2023-08-31 07:11:42 浏览: 46
Bootstrap 4 provides a flexible and responsive grid system for creating tables. Here's an example of how you can create a table using Bootstrap 4:
```html
<table class="table">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Name</th>
<th scope="col">Email</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>John Doe</td>
<td>john@example.com</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jane Smith</td>
<td>jane@example.com</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Mike Johnson</td>
<td>mike@example.com</td>
</tr>
</tbody>
</table>
```
In this example, the `table` class is added to the `table` element to apply the default styling provided by Bootstrap. The `thead` element is used to define the table header row, and the `tbody` element is used to define the table body.
Each table row is created using the `tr` element, and table headers are defined using the `th` element with the `scope="col"` attribute. Table data cells are defined using the `td` element.
You can further customize the table by adding additional classes and applying various Bootstrap table-related utility classes.