It is possible to change the output of the menu, by creating a new menu Walker. I wouldn’t recommend this solution, however, since you’re attempting to do something that’s actually invalid HTML – the ul
tag should only have li
tags inside it, never anything else.
I know it’s possible to create the solution you’re looking for with css and javascript, as I’ve done it many times before. I can’t speak to your particular situation for an exact solution, but possibly try styling the a
links inside the li
for the main menu; then your nested submenus can have whatever styles they need.