Home you can not change the structure from table
to div
as your friend Wallace suggested here has a table
template only with Bootstrap classes default .
Note that setting the size of col-
from the first th
to the second nor th
assumed an implicit width.
<link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<div class="container">
<table class="table table-bordered table-striped">
<thead>
<tr class="text-center">
<th class="col-xs-10 text-center">nome</th>
<th class="text-center">editar</th>
</tr>
</thead>
<tbody>
<tr class="text-center">
<td>nome</td>
<td><button class="btn btn-primary">X</button></td>
</tr>
<tr class="text-center">
<td>nome</td>
<td><button class="btn btn-primary">X</button></td>
</tr>
<tr class="text-center">
<td>nome</td>
<td><button class="btn btn-primary">X</button></td>
</tr>
</tbody>
</table>
</div>
w-100
Now if you want to do with some custom CSS you can simply determine a width of 100% for first TH
, so it occupies all space and the second TH
only occupies the size of itself.
In this example I created a class .w-100
that corresponds to width:100%
and put it in the first TH
, just this ...
.w-100 {
width: 100%;
}
<link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<div class="container">
<table class="table table-bordered table-striped">
<thead>
<tr class="text-center">
<th class="w-100 text-center">nome</th>
<th class="text-center">editar</th>
</tr>
</thead>
<tbody>
<tr class="text-center">
<td>nome</td>
<td><button class="btn btn-primary">X</button></td>
</tr>
<tr class="text-center">
<td>nome</td>
<td><button class="btn btn-primary">X</button></td>
</tr>
<tr class="text-center">
<td>nome</td>
<td><button class="btn btn-primary">X</button></td>
</tr>
</tbody>
</table>
</div>