How do you place p tag on a new line when using aria-label breadcrumb?

Viewed 81

I have a nav element and am trying to display text underneath that breadcrumb navbar instead of next to it. I've tried to add a display: inline-block line to my navbar property in CSS but I am still getting the same result.

It works when I had 2 or 3 <br> tags following the navbar, but I don't want to do that on every page. I'd like to use CSS.

Here is the snippet:

.first {
  display: inline-block;
}

nav.breadcrumb {
  padding-top: 0.8em;
  padding-bottom: 0.8em;
  padding-left: 0.5em;
  padding-right: 0.5em;
  border: 1px solid hsl(0, 0%, 90%);
  border-radius: 4px;
  background: hsl(300, 14%, 97%);
  font-size: 14px;
  float: left;
  max-width: 45%;
}

nav.breadcrumb ol {
  margin: 0;
  padding-left: 0;
  list-style: none;
  left: 0px;
}

nav.breadcrumb li {
  display: inline;
}

nav.breadcrumb li+li::before {
  display: inline-block;
  margin: 0 0.25em;
  transform: rotate(15deg);
  border-right: 0.1em solid currentColor;
  height: 0.8em;
  content: '';
}

nav.breadcrumb [aria-current="page"] {
  color: #000;
  font-weight: 700;
  text-decoration: none;
  max-width: 45%;
}
<nav aria-label="Breadcrumb" class="breadcrumb">
  <ol>
    <li><a href="/">Home</a></li>
    <li><a href="/reamers">Reamers</a></li>
    <li>Jarno Reamers</li>
  </ol>
</nav>

<p class="first">Contact Us for <a href="https://gammons.com/reamers">reamers</a> or to ask about other offerings not listed below.</p>

Here is the fiddle result.

3 Answers

Delete float: left in .nav.breadcrumb

On nav.breadcrumb add style display: inline-block; and remove float: left

Remove display: inline-block; from .first

nav.breadcrumb {
    padding-top: 0.8em;
    padding-bottom: 0.8em;
    padding-left: 0.5em;
    padding-right: 0.5em;
    border: 1px solid hsl(0, 0%, 90%);
    border-radius: 4px;
    background: hsl(300, 14%, 97%);
    font-size: 14px;
    max-width: 45%;
    display: inline-block;
}

nav.breadcrumb ol {
    margin: 0;
    padding-left: 0;
    list-style: none;
    left: 0px;
}

nav.breadcrumb li {
    display: inline;
}

nav.breadcrumb li+li::before {
    display: inline-block;
    margin: 0 0.25em;
    transform: rotate(15deg);
    border-right: 0.1em solid currentColor;
    height: 0.8em;
    content: '';
}

nav.breadcrumb [aria-current="page"] {
    color: #000;
    font-weight: 700;
    text-decoration: none;
    max-width: 45%;
}
<nav aria-label="Breadcrumb" class="breadcrumb">
    <ol>
        <li><a href="/">Home</a></li>
        <li><a href="/reamers">Reamers</a></li>
        <li>Jarno Reamers</li>
    </ol>
</nav>

<p class="first">Contact Us for <a href="https://gammons.com/reamers">reamers</a> or to ask about other offerings not listed below.</p>

Related