is there a way to make the hover function fill space follow border lines below its block element

21 Views Asked by At

On the li above each horizontal border line, how would I get the hover color to overflow just within the border without covering the boarder line? Is this possible with just CSS? Right now I have sharp edges and gaps in the spacing that need to be rounded and filled.

nav {
  text-align: center;
  border: 2px solid #370d6b;
  border-radius: 2rem;
  margin: 0.5rem auto 1rem;
  max-width: 300px;
  font-size: 1.25rem;
  line-height: .5rem;
  border-color: #ffffff;
  color: #ffffff;
}

nav li {
  padding: 0;
  margin: 0px;
}

nav ul {
  list-style: none;
  margin: 0;
  padding-left: 0px;
  border-radius: 2rem 2rem 0 0;
}

nav ul ul {
  font-size: 1rem;
  line-height: .5rem;
  border-top: 1px solid #ffffff;
  margin: 0px;
}

nav li a {
  display: block;
  box-sizing: border-box;
  padding: 10px;
  text-decoration: none;
  color: #ffffff;
  margin: 0px;
}

nav li a,
li a:visited {
  text-decoration: none;
  color: #ffffff;
  margin: 0px;
}

nav li a:hover,
li a:focus {
  text-decoration: underline;
  background-color: #46146e;
}

ul ul li a {
  font-size: .75rem;
}

nav>ul>li:not(:first-child) {
  border-top: 1px solid #ffffff;
  border-radius: 2rem 2rem 0 0;
}
<nav>
  <ul>
    <li><a href="#New_Horizons">Chapter 1: New Horizons</a>
      <ul>
        <li><a href="#A_Mind_Made-Up">A Mind Made-Up</a></li>
        <li><a href="#Difficulty_Launching">Difficulty Launching</a></li>
        <li><a href="#The_Conundrum">The Conundrum</a></li>
      </ul>
    </li>
    <li><a href="#Chapter2">Chapter 2</a>
      <ul>
        <li><a href="#Chapter2">**PH_1</a></li>
        <li><a href="#Chapter2">**PH_2</a></li>
      </ul>
    </li>
  </ul>
</nav>

I have tried adjusting the border radius of border top and bottom to 2rem

0

There are 0 best solutions below