I was trying to create a responsive menu but selecting a specific element worked out differently. For example, when I selected "nav ul li" for list styles in the default size and selected "ul li" for list style in the breakpoint, it didn't work as I intended.
It was fixed when I selected "ul li" for both the default size and the breakpoint but I don't know why it fixed the issue because as far as I know, selecting "nav ul li" and "ul li" are the same thing. Could somebody help me with this?
nav {
  width: 100%;
  background-color: darkblue;
}
ul {
  width: 80%;
  margin: 0 auto;
  padding: 0;
}
nav ul li {
  list-style-type: none;
  display: inline-block;
  padding: 20px;
}
ul li:hover {
  background-color: orange;
}
ul li a {
  color: #ffffff;
  text-decoration: none;
}
.toggle {
  width: 100%;
  padding: 10px 20px;
  background-color: #001f44;
  text-align: right;
  box-sizing: border-box;
  color: #ffffff;
  font-size: 30px;
  /* to hide toggle */
  display: none;
}
/*  Break Point for the toggle */
@media screen and (max-width:768px) {
  .toggle {
    display: block;
  }
  ul {
    width: 100%;
  }
  ul li {
    display: block;
    text-align: center;
  }
}
<div class="toggle">
  <i class="fa fa-bars"></i>
</div>
<nav>
  <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">About</a></li>
    <li><a href="#">Portfolio</a></li>
    <li><a href="#">Resume</a></li>
  </ul>
</nav>