Stretched link
Preview
This is a preview of the Bootstrap element. For more details, please visit the official Bootstrap page.
Bootstrap pageAbout
Add .stretched-link to a link to make its containing block clickable via a ::after pseudo element. In most cases, this means that an element with position: relative; that contains a link with the .stretched-link class is clickable. Please note given how CSS position works, .stretched-link cannot be mixed with most table elements.
Cards have 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.
Examples
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: 20rem;">
<img src="..." class="card-img-top">
<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 href="#" class="btn btn-primary stretched-link">Go somewhere</a>
</div>
</div>
Most custom components do not have position: relative by default, so we need to add the .position-relative here to prevent the link from stretching outside the parent element.
Custom component with stretched link
This is some placeholder content for the custom component. It is intended to mimic what some real-world content would look like, and we're using it here to give the component a bit of body and size.
Go somewhere<div class="d-flex position-relative"> <img src="..." class="flex-shrink-0 me-3" style="max-width: 200px;"> <div> <h5 class="mt-0">Custom component with stretched link</h5> <p>This is some placeholder content for the custom component. It is intended to mimic what some real-world content would look like, and we're using it here to give the component a bit of body and size.</p> <a href="#" class="stretched-link">Go somewhere</a> </div> </div>