0

I keep getting a validation error, I tried to wrap the code in li tag but then it messes up the button tag?? is there a way to get it to work not sure where I'm going wrong is there any other tag to use instead of the button tag?

  <ul class="nav">
    <li><a href="index.html">Home</a></li>
    <li><a href="coffee-origin.html">Origins of Coffee</a></li>

  <ul class="subnav">
        <button class="subnavbtn">More About Coffee ▾ </button>

            <ul class="subnav-content">
                <li><a href="coffee-types.html"> Coffee Types</a></li>
                <li><a href="coffee-prduction.html"> Production</a></li>
                <li><a href="further-resources.html"> Further Resources</a></li>
            </ul>

  </ul>

  </ul>
</nav>
Khushi
  • 1

2 Answers2

1

The proper HTML should be the second UL being inside of an li and the button inside of an li.

<nav>
  <ul class="nav">
    <li><a href="index.html">Home</a></li>
    <li><a href="coffee-origin.html">Origins of Coffee</a></li>
    <li><button class="subnavbtn">More About Coffee ▾ </button>
      <ul class="subnav-content">
        <li><a href="coffee-types.html"> Coffee Types</a></li>
        <li><a href="coffee-prduction.html"> Production</a></li>
        <li><a href="further-resources.html"> Further Resources</a></li>
      </ul>
    </li>
  </ul>
</nav>
epascarello
  • 204,599
  • 20
  • 195
  • 236
0

Use a drop-down in place of that shall be better

<div id="dropdown">
  <button onclick="showdrop()" id="dropbtn">More About Coffee ▾</button>
  <div id="dropdown-content" style="display:none;">
      <a href="coffee-types.html"> Coffee Types</a>
      <a href="coffee-prduction.html"> Production</a>
      <a href="further-resources.html"> Further Resources</a>
  </div>
</div>

And in javascript

function showdrop(){
 document.getElementById('dropdown-content').style.display="block";
 
}
Lalan Kumar
  • 107
  • 6