.stretched-link to a link to make its containing block clickable
::after pseudo element. In most cases, this means that an element
position: relative; that contains a link with the
.stretched-link class is clickable.
position: relative by default in Bootstrap, so in this case
you can safely add the
.stretched-link class to a link in the card
without any other HTML changes.
Multiple links and tap targets are not recommended with stretched links. However,
z-index styles can help should this be
Card with stretched link
Some quick example text to build on the card title and make up the bulk of the card's content.Go somewhere
<div class="card" style="width: 18rem;"> <img class="card-img-top" src="../assets/img/generic/1.jpg" alt="..."> <div class="card-body"> <h5 class="card-title">Card with stretched link</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> <a class="btn btn-primary stretched-link" href="#">Go somewhere</a> </div> </div>