私は、3列と数行(サーバーからのデータで動的に追加)のブートストラップでスタイリングされたシンプルなテーブルを持っています。最後のセルの前に境界線を削除します
<table class="table table-bordered">
<tr>
<th>Data</th>
<th>Value</th>
<th><!-- Should be 'Edit' but I'm hiding it--></th>
</tr>
<tr>
<td>data</td>
<td>value</td>
<td width="70px"><a href="/link/to/edit/value">Edit</a></td>
</tr>
</table>
私はそれが1列であるようにそれが見えるようにする列Value
とEdit
間の境界線を削除します。
これは私が試したものです:それは実際に働いているが、私は!important
パラメータを使用したくない
<style>
th:last-child, td:last-child {
border-left: none !important;
}
th:nth-last-child(2), td:nth-last-child(2) {
border-right:none !important;
}
</style>
。
!important
せずにこれを行う方法、あるいはこのように同じセル内の両方の情報を入れるための別の方法があります:セルの真ん中にValue
情報、および右側のEdit
情報?私はinline
ようにそれを行うには良い方法があると確信している、
<style>
body table.table.table-bordered tr th:last-child,
body table.table.table-bordered tr td:last-child {
border-left: none;
}
body table.table.table-bordered tr th:nth-last-child(2),
body table.table.table-bordered tr td:nth-last-child(2) {
border-right: none;
}
</style>
それがうまく機能している場合でも:編集
は私にあるwithout !important wayを与えるためにあなたAaronをありがとう方法。何か案は ?
でも動作しますが、私は '!important'タグを使用せずにこれを行う方法を探しています – tektiv
@tektiv申し訳ありません、それらを間違えて残しました。更新されたバージョン – Aaron
Brillant!それはうまくいきました。最初のスタイルルールの 'td:last-child'を' body table.table.table-bordered tr td:last-child'に置き換えるだけでした。ありがとうございました ! – tektiv