I'm facing a small but annoying issue with my button group. The last button in the group appears rectangular instead of having rounded corners at the top right and bottom right. This is because the a.btn
element is followed by a modal within the btn-group
, which Bootstrap considers to be the group's last child. The modal is triggered by the last button, so I want it to remain in that position for ease of use, rather than risking it getting lost by moving it around.
How can I ensure that the last button in my button group maintains the proper style? I could manually add the attribute
style="border-top-right-radius: 0.2rem; border-bottom-right-radius: 0.2rem"
to override Bootstrap's CSS for that specific button, but it feels like a hack. Perhaps there is a way to manually designate last children? Simply adding "lastchild" inside the opening tag would be a cleaner solution (unfortunately, it's not possible).
https://i.sstatic.net/QpHWf.png
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Admin Page</title>
</head>
<body>
<div class="container">
<div class="row">
<table class="table table-hover text-center">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Last name</th>
<th scope="col">Department</th>
<th scope="col">Buttons</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td>IT</td>
<td class="btn-group btn-group-sm">
<a class="btn btn-outline-secondary" href="#">1st button</a>
<a class="btn btn-outline-primary" href="#">2nd button</a>
<p hidden>Anything at all</p>
</td>
</tr>
<tr>
<td>Jane</td>
<td>Doe</td>
<td>HR</td>
<td class="btn-group btn-group-sm">
<a class="btn btn-outline-secondary" href="#">1st button</a>
<a class="btn btn-outline-primary" href="#">2nd button</a>
<p hidden>Anything at all</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c5afb4b0a0b7bc85f6ebf3ebf6">[email protected]</a>/dist/jquery.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ed9d829d9d889fc3879eaddcc3dcdbc3dc">[email protected]</a>/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4a2825253e393e382b3a0a7e647c6478">[email protected]</a>/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>