Jump to content

w3.css nav menus and ul & li tags

Recommended Posts

I've been building my website for the first time using w3.css 4 - which I think is brilliant by the way. Makes things so much quicker.

However, I've been wondering... when building a drop-down menu (like below) is there any requirement to include <ul> and <li> tags, even though the menu works and displays perfectly just using the w3 classes.

I am guessing that it's most prob good practice to include the <ul> tags for search engine crawling purposes, but if anyone can shed any light on whether the these tags are actually required, I would appreciate it.


<!-- From https://www.w3schools.com/w3css/w3css_dropdowns.asp -->

<div class="w3-dropdown-click">
    <button onclick="myFunction()" class="w3-button w3-black">Click me</button>
    <div id="Demo" class="w3-dropdown-content w3-bar-block w3-card-4 w3-animate-zoom">
      <a href="#" class="w3-bar-item w3-button">Link 1</a>
      <a href="#" class="w3-bar-item w3-button">Link 2</a>
      <a href="#" class="w3-bar-item w3-button">Link 3</a>


Share this post

Link to post
Share on other sites

For simple menu like yours no! The ul and li  are not required, for menu that include sub or child menus, then a unordered listing (bullet list)  would be preferable  because of it nesting structure of UL and LI elements.

  • Like 1

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now