Reputation: 95
I have a list of the process where each row has a link called "Collapse" which if clicked should open a "container area", where I can put some other stuff inside.
What I've done so far is this:
But as you can see, the container will have the same size as the first column "# ".
How could I avoid this? Or is there a better way to do this using divs or whatever?
Here is the code:
<div class="container">
<table class="table table-striped">
<tr>
<th class="th-lg"><a>#</a></th>
<th class="th-lg"><a>Status</a></th>
<th class="th-lg"><a>ID</a></th>
<th class="th-lg"><a>Process Name</a></th>
<th class="th-lg"><a>Actions</a></th>
<th></th>
</tr>
<tr>
<td>1</td>
<td><button type="button" class="btn btn-success">Active</button></td>
<td>14</td>
<td>foobarbaz</td>
<td>
<button type="button" class="btn btn-primary">Success</button>
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-danger">Success</button>
</td>
<td>
<a data-toggle="collapse" href="#tr_a" role="button" aria-expanded="false" aria-controls="tr_a">
<span>Collapse</span>
</a>
</td>
</tr>
<tr id="tr_a" class="collapse">
<td>container</td>
</tr>
<tr>
<td>2</td>
<td><button type="button" class="btn btn-danger">Down</button></td>
<td>15</td>
<td>foobarbaz</td>
<td>
<button type="button" class="btn btn-primary">Success</button>
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-danger">Success</button>
</td>
<td>
<a data-toggle="collapse" href="#tr_b" role="button" aria-expanded="false" aria-controls="tr_b">
<span>Collapse</span>
</a>
</td>
</tr>
<tr id="tr_b" class="collapse">
<td>container</td>
</tr>
</table>
Upvotes: 1
Views: 313
Reputation: 14415
You can use the rowspan
attribute to make your container span multiple columns:
<tr id="tr_b" class="collapse">
<td colspan="6">container</td>
</tr>
td {
border: 1px solid red;
}
<div class="container">
<table class="table table-striped">
<tbody>
<tr>
<th class="th-lg"><a>#</a></th>
<th class="th-lg"><a>Status</a></th>
<th class="th-lg"><a>ID</a></th>
<th class="th-lg"><a>Process Name</a></th>
<th class="th-lg"><a>Actions</a></th>
<th></th>
</tr>
<tr>
<td>1</td>
<td><button type="button" class="btn btn-success">Active</button></td>
<td>14</td>
<td>foobarbaz</td>
<td><button type="button" class="btn btn-primary">Success</button> <button type="button" class="btn btn-success">Success</button> <button type="button" class="btn btn-danger">Success</button></td>
<td>
<a data-toggle="collapse" href="#tr_a" role="button" aria-expanded="false" aria-controls="tr_a"> <span>Collapse</span> </a>
</td>
</tr>
<tr id="tr_a" class="collapse">
<td colspan="6">container</td>
</tr>
</tbody>
</table>
</div>
(Red borders are for visualization only)
Upvotes: 2
Reputation: 1
You can try add colspan attribute with value 6 which represent you want to merge 6 columns into 1
<td colspan="6">container</td>
Thanks..
Upvotes: 0