1

I am trying to create a nav breadcrumb based on Mozilla's nav demo

nav {
    border-bottom: 1px solid black;
}

.crumbs ol {
    list-style-type: none;
    padding-left: 0;
}

.crumb {
    display: inline-block;
}

.crumb a::after {
    display: inline-block;
    color: #000;
    content: '>';
    font-size: 80%;
    font-weight: bold;
    padding: 0 3px;
}
<nav class="crumbs">
    <ol>
        <li class="crumb"><a href="bikes">Bikes</a></li>
        <li class="crumb"><a href="bikes/bmx">BMX</a></li>
        <li class="crumb">Jump Bike 3000</li>
    </ol>
</nav>

I'm trying to remove the inserted "whitespace" that's to the left of the Jump Bike 3000 (on the right side of the >). I can see the issue in both Firefox and Chrome. In Firefox's inspect element, it actually shows this as whitespace in the DOM: enter image description here

Is there any way to remove this?

kleaver
  • 619
  • 8
  • 14

2 Answers2

1

Removing the literal whitespace between the elements in the markup will do it, but Rayees AC's answer is better.

nav {
    border-bottom: 1px solid black;
}

.crumbs ol {
    list-style-type: none;
    padding-left: 0;
}

.crumb {
    display: inline-block;
}

.crumb a::after {
    display: inline-block;
    color: #000;
    content: '>';
    font-size: 80%;
    font-weight: bold;
    padding: 0 3px;
}
<nav class="crumbs">
    <ol>
        <li class="crumb"><a href="bikes">Bikes</a></li><li class="crumb"><a href="bikes/bmx">BMX</a></li><li class="crumb">Jump Bike 3000</li>
    </ol>
</nav>
ray hatfield
  • 16,302
  • 4
  • 25
  • 21
1

remove li inline-block and add display:flex to ol

.crumbs ol {
 display: flex;
 flex-wrap: wrap;
}

nav {
    border-bottom: 1px solid black;
}

.crumbs ol {
    list-style-type: none;
    padding-left: 0;
    display: flex;
    flex-wrap:wrap;
}

.crumb {
    display: inline-block;
}

.crumb a::after {
    display: inline-block;
    color: #000;
    content: '>';
    font-size: 80%;
    font-weight: bold;
    
}
<nav class="crumbs">
    <ol>
        <li class="crumb"><a href="bikes">Bikes</a></li>
        <li class="crumb"><a href="bikes/bmx">BMX</a></li>
        <li class="crumb">Jump Bike 3000</li>
    </ol>
</nav>
Rayees AC
  • 4,008
  • 3
  • 6
  • 27