When the text in the breadcrumbs in Bootstrap4-aplha6 is too long the las crumb will jump to the next line:
<nav class="breadcrumb">
  <a class="breadcrumb-item" href="#">Home</a>
  <a class="breadcrumb-item" href="#">Library</a>
  <a class="breadcrumb-item" href="#">Data</a>
  <span class="breadcrumb-item active">A slightly too long title</span>
</nav>
Produces:
 ---------------------------------
|                                 |
| Home / Library / Data           |
|   / A slightly too long title   |
|                                 |
|                                 |
|                                 |
 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
And I would like:
 ---------------------------------
|                                 |
| Home / Library / Data / A slig… |
|                                 |
|                                 |
|                                 |
 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
I have tried fixing this with white-space: nowrap, overflow: hidden and text-overflow: ellipsis and it does not seem to work well because, for some reason, in Bootstrap4, the breadcrumb-items are blocks floated left.
Did anyone find the way to fix this without overwriting all the Bootstrap classes (the ellipsis is not 100% necessary)?
They can be changed by modifying a local CSS custom property --bs-breadcrumb-divider , or through the $breadcrumb-divider Sass variable — and $breadcrumb-divider-flipped for its RTL counterpart, if needed. We default to our Sass variable, which is set as a fallback to the custom property.
Indicate the current page's location within a navigational hierarchy that automatically adds separators via CSS.
Generally, you will use <nav>, <ol> and <li> tags of HTML for creating breadcrumbs.
A breadcrumb navigation provide links back to each previous page the user navigated through, and shows the user's current location in a website.
Michael's solution seems no longer work with Bootstrap 4.1 when using the official breadcrumb snippet (with <ol> and <li> tags). Here is another solution.
.breadcrumb {
    display: block !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.breadcrumb .breadcrumb-item {
    display: inline;
}<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
    <div class="container">             
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="#">Home</a></li>
                <li class="breadcrumb-item"><a href="#">My category</a></li>
                <li class="breadcrumb-item"><a href="#">My category</a></li>
                <li class="breadcrumb-item"><a href="#">My category</a></li>
                <li class="breadcrumb-item"><a href="#">My category</a></li>
                <li class="breadcrumb-item"><a href="#">My category</a></li>
                <li class="breadcrumb-item active" aria-current="page">My page</li>       
            </ol>
        </nav>        
    </div>If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With