Я хотел бы знать, как я могу удалить подчеркивание в конце таблицы? я нахожу это некрасивым... Я не вижу, как это удалить?
Вот код ниже:
<!DOCTYPE html>
<html>
<head>
<title>HTML CSS JS</title>
</head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<body>
<div class="modal-header">
<h4 class="modal-title" id="modal-basic-title">Confirmation</h4>
<button type="button" class="btn-close" aria-label="Close button" aria-describedby="modal-title" (click)="modal.hide()">
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<div class="row">
<div class="col-12 col-sm-12 mb-2">
<table class="table table-hover table-striped spaceLeft " style="width: 100%">
<tbody>
<tr>
<th>Purchase of </th>
<td style="min-width: 100%"> 5 Ittroises BE 34120185 </td>
</tr>
<tr>
<th style="width: 60%">Valid until</th>
<td style="min-width: 100%">01/01/2022 </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" (click)="goBack()" data-dismiss="modal">Fermer</button>
<button type="submit" class="btn btn-primary" (click)="sendCancelOrderRequest()">Confirmer</button>
</div>
</div>
</body>
</html>
Заранее спасибо за вашу помощь
<tr>
<th style="width: 60%; border-bottom: none;">Valid until</th>
<td style="min-width: 100%; border-bottom: none;">
01/01/2022
</td>
</tr>
если в таблице более 1 строки, все нижние границы td будут иметь 0 пикселей, и я думаю, что это не желаемый результат
Если вы хотите добавить больше информации в свой ответ, я предлагаю вам отредактировать его вместо добавления комментариев.
В данном конкретном примере все стили написаны внутри html
Эта граница пришла из tr таблицы, поэтому вы можете добавить:
tr:last-child{
border-bottom: none;
}
я использую псевдоселектор «last-child
», потому что без него все tr будут иметь нижнюю границу 0px
<style>
table > tbody > tr:last-child > * {
border-bottom-width: 0;
}
</style>
<!DOCTYPE html>
<html>
<head>
<title>HTML CSS JS</title>
</head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<body>
<div class="modal-header">
<h4 class="modal-title" id="modal-basic-title">Confirmation</h4>
<button type="button" class="btn-close" aria-label="Close button" aria-describedby="modal-title" (click)="modal.hide()">
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<div class="row">
<div class="col-12 col-sm-12 mb-2">
<table class="table table-hover table-striped spaceLeft " style="width: 100%">
<tbody>
<tr>
<th>Purchase of </th>
<td style="min-width: 100%"> 5 Ittroises BE 34120185 </td>
</tr>
<tr>
<th style="width: 60%">Valid until</th>
<td style="min-width: 100%">01/01/2022 </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" (click)="goBack()" data-dismiss="modal">Fermer</button>
<button type="submit" class="btn btn-primary" (click)="sendCancelOrderRequest()">Confirmer</button>
</div>
</div>
</body>
</html>
Если вам не нужна граница, вы можете установить border:none
.
Граница, которую вы не хотите, применяется к td и th последнего элемента tr, поэтому ваш селектор .table tr:last-child th, .table tr:last-child td
.table tr:last-child th,
.table tr:last-child td{
border:none;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<table class="table table-hover table-striped spaceLeft " style="width: 100%">
<tbody>
<tr>
<th>Purchase of </th>
<td style="min-width: 100%"> 5 Ittroises BE 34120185 </td>
</tr>
<tr>
<th style="width: 60%">Valid until</th>
<td style="min-width: 100%">01/01/2022 </td>
</tr>
</tbody>
</table>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" (click)="goBack()" data-dismiss="modal">Fermer</button>
<button type="submit" class="btn btn-primary" (click)="sendCancelOrderRequest()">Confirmer</button>
</div>
Вы можете использовать теги CSS или стиля, чтобы сделать это в зависимости от того, что вы хотите - простой пример ниже
<html>
<head>
<title>HTML CSS JS</title>
</head>
<style>
tr.no-bottom-border td {border-bottom: none}
tr.no-bottom-border th {border-bottom: none}
</style>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<body>
<div class="modal-header">
<h4 class="modal-title" id="modal-basic-title">Confirmation</h4>
<button type="button" class="btn-close" aria-label="Close button" aria-describedby="modal-title" (click)="modal.hide()">
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<div class="row">
<div class="col-12 col-sm-12 mb-2">
<table class="table table-hover table-striped spaceLeft " style="width: 100%">
<tbody>
<tr>
<th>Purchase of </th>
<td style="min-width: 100%"> 5 Ittroises BE 34120185 </td>
</tr>
<tr class="no-bottom-border">
<th style="width: 60%">Valid until</th>
<td style="min-width: 100%">01/01/2022 </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" (click)="goBack()" data-dismiss="modal">Fermer</button>
<button type="submit" class="btn btn-primary" (click)="sendCancelOrderRequest()">Confirmer</button>
</div>
</div>
</body>
</html>
Вы можете добавить стиль CSS к th и td => border-bottom: none;