Jump to content
ScotBlue

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.

Cheers.

<!-- 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>
    </div>
  </div>

 

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...