html - 如何在引导程序 4 中使每一列彼此相等
问题描述
大家好,我正在尝试使我的列的宽度彼此相等。我希望所有列的宽度都相同,除了列更新和删除。这两个人应该和现在一样。
我正在使用引导程序 4.5.2
这是我的引导表
<table class="table table-bordered table-responsive-sm table-hover">
<thead>
<tr>
<th>Date</th>
<th>TimeSlot</th>
<th>Room</th>
<th>Attendees</th>
<th>update</th>
<th>delete</th>
</tr>
</thead>
<tbody>
<tr class="table">
<td class="table">Date</td>
<td class="table">Time</td>
<td class="table">Room</td>
<td class="table">invitee</td>
<td class="table" style="display: none">reservationid</td>
<td class="table" style="display: none">invitedby</td>
<td class="table" style="display: none">workspace</td>
<td class="table">
<a onclick="onUpdate()" style="color: #007bff; cursor: pointer"> <i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
</td>
<td class="table">
<a onclick="onDelete()" style="color: #007bff; cursor: pointer"> <i class="fa fa-trash" aria-hidden="true"></i></a> </td>
</tr>
</tbody>
}
</table>
解决方案
您需要以某种方式将您的数据列与命令列区分开来,并将您的 CSS 仅应用于您的数据列:
td.table:not(.command) {
border: 1px solid black;
width: 15% !important;
}
<table class="table table-bordered table-responsive-sm table-hover">
<thead>
<tr>
<th>Date</th>
<th>TimeSlot</th>
<th>Room</th>
<th>Attendees</th>
<th>update</th>
<th>delete</th>
</tr>
</thead>
<tbody>
<tr class="table">
<td class="table">Date</td>
<td class="table">Time</td>
<td class="table">Room</td>
<td class="table">invitee</td>
<td class="table" style="display: none">reservationid</td>
<td class="table" style="display: none">invitedby</td>
<td class="table" style="display: none">workspace</td>
<td class="table command">
<a onclick="onUpdate()" style="color: #007bff; cursor: pointer"> <i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
</td>
<td class="table command">
<a onclick="onDelete()" style="color: #007bff; cursor: pointer"> <i class="fa fa-trash" aria-hidden="true"></i></a> </td>
</tr>
</tbody>
}
</table>
推荐阅读
- python-3.x - 如何在熊猫数据框列内的列表内分解/拆分嵌套列表并从中制作单独的列?
- visual-studio - 如何在共享代码项目代码上定义编译时间变量
- c - 如何将 execv 用于 grep?
- r - R中按组进行插值/外插
- c# - 我将如何以编程方式告诉 Visual Studio 加载外部修改?
- list - Kotlin 声明固定大小的相同值的列表
- google-cloud-platform - 如何在一个 Firebase 应用中使用多个 Dialogflow 代理
- asp.net - Net Framework Xunit 与 Moq 单元测试保持调用原始函数
- angular - 在 Angular 8.3.23 上使用多个嵌套自定义数据填充 mat-table
- asynchronous - 期货::选择有什么区别!和 tokio::select?