Spaces between words in menu not working. Must remove space between words to make submenu work

29 views Asked by At

My index file has a menu item I want named "What We Do", but the only way to get the sub-menus to appear is to remove the spaces and write "WhatWeDo"

How do I get it to allow multiple word menu items?

I have to write

  • HOME
  •    <li class='menu-item-has-children'>
            <a>WHATWEDO</a>
            <ul class='sub-menu'>
    

    in order to make the sub-menus to appear.

    2

    There are 2 answers

    1
    alex On

    HTML does not support whitespace characters. If you want to obtain a space, you need to use &nbsp.

    <li class='menu-item-has-children'>
      <a>WHAT&nbspWE&nbspDO</a>
    <ul class='sub-menu'>
    
    0
    sherry On

    In HTML, you can create nested lists using the <ul> (unordered list) and <ol> (ordered list) elements for creating lists and the <li> (list item) element to define individual list items. By nesting these elements, you can create lists within lists. Here's how to create a nested list in HTML:

    <ul>
      <li><a href="#">Home</a></li>
      <li><a href="#">What We Do</a>
        <ul>
          <li><a href="#">Subitem 1</a></li>
          <li><a href="#">Subitem 2</a></li>
        </ul>
      </li>
    </ul>