Drupal 8 gives the flexibility to make menu template and design the menu with our need, to do this --

  • You need to find the default template in core system folder, path is "drupal/core/modules/system/templates/menu.html.twig"
  • Copy this is default file to your theme folder and rename it with your menu name "menu--MachineName.html.twig" where MachineName is the machine name of the menu. e.g "menu--main.html.twig"
  • Clear the cache.

For more details please look this Page