On my breadcrumbs in Bootstrap 4 after the first li I need to be able to remove forward slash
Change
Location: / Catalog
To
Location: Catalog
Question: How am I able to remove the first forward slash on bootstrap breadcrumbs
I tried
.breadcrumb-item:first-of-type::before {
display: inline-block;
padding-right: 0.5rem;
padding-left: 0.5rem;
color: #868e96;
content: "";
}
HTML
<div class="modal-header justify-content-center">
<ol class="breadcrumb">
<li class="breadcrumb-item">Location: </li>
<?php foreach ($breadcrumbs as $breadcrumb) { ?>
<li class="breadcrumb-item"><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
<?php } ?>
</ol>
</div>
I believe what you're looking for is this.
Since Bootstrap adds the /
before the elements starting on the second element, we have to select the second element by using the nth-child()
CSS selector like so.
.breadcrumb .breadcrumb-item:nth-child(2)::before {
content: "";
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<div class="modal-header justify-content-center">
<ol class="breadcrumb">
<li class="breadcrumb-item">Location: </li>
<li class="breadcrumb-item"><a href="#">Content</a></li>
</ol>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments