Да, определенно только незначительные изменения в css, и вы получите то, что хотите. Просто обновите css
/*adapted from https://www.andrewnoske.com/wiki/CSS_-_Multilevel_Navigation_Bar */
body { margin: 0; padding: 0; background: #eee; }
/* Navigation Bar */
.nav {
background: linear-gradient(to bottom, #57b759, #007a00); /* Green gradient - light to dark. */
font-size: 14px;
font-family: Arial, sans-serif;
text-align: left;
}
.nav > ul a {
color: #fff;
}
.nav > ul,
.nav > ul ul {
list-style: none;
margin: 0;
padding: 0;
}
.nav > ul li {
position: relative;
}
.nav > ul a {
padding:10px;
display: block;
text-decoration: none;
border-radius: .2em;
}
.nav > ul a:hover {
opacity: 1.0;
background-color: rgba(0, 0, 0, 0.3);
}
/* Active Menu Item */
.nav .active {
opacity: 1.0;
background-color: rgba(255, 255, 255, 0.5);
color: #000;
border-radius: .2em;
}
/* Navigation Bar - Level 1 Drop Down Menu */
.nav > ul > li {
display: inline-block;
vertical-align: top;
margin-left: -4px;
}
.nav > ul > li:first-child {
margin-left: 0;
}
.nav > ul > li > a {}
.nav > ul > li > a:hover {}
/* Navigation Bar - Level 2 */
.nav > ul > li > ul {
text-align: left;
width: auto; /* Change auto value with 200px if you want a bigger menu */
display: none;
background: #007a00; /* Dark green. */
position: absolute;
top: 0;
left: 0;
padding-bottom: 5px;
min-width: 150px;
border-radius: 0 0 .5em .5em;
z-index: 9999999;
}
.nav > ul > li:hover > ul {
display: block;
}
.nav > ul ul li a {}
.nav > ul ul li a:hover {}
/* Navigation Bar - Level 3 */
.nav > ul > li > ul > li > ul {
text-align: left;
display: none;
background: #57b759; /* Light green. */
position: absolute;
left: 100%;
top: 0;
padding-bottom: 5px;
min-width: 150px;
border-radius: 0 0 .5em .5em;
z-index: 9999999;
}
.nav > ul > li > ul > li:hover > ul {
display: block;
}
.nav > ul ul ul li {}
.nav > ul ul ul li a {}
.nav > ul ul ul li a:hover {}
/* Navigation Bar - Level 4 */
.nav > ul > li > ul > li > ul > li > ul {
text-align: left;
display: none;
background: #57b759; /* Light green. */
position: absolute;
left: 100%;
top: 0;
padding-bottom: 5px;
min-width: 250px;
border-radius: 0 0 .5em .5em;
z-index: 9999999;
}
.nav > ul > li > ul > li > ul > li:hover > ul {
display: block;
}
.nav > ul ul ul ul li {}
.nav > ul ul ul ul li a {}
.nav > ul ul ul ul li a:hover {}
.nav > ul {
display: flex;
flex-direction: column;
}
.nav {
width: 200px;
height: 100vh;
}
.nav > ul > li > ul {
z-index: 9999999;
right: 0;
left: 200px;
}
<nav class="nav">
<ul>
<li><a href="#">Section 1</a></li>
<li><a href="#">Section 2 ▾</a>
<ul>
<li><a href="#">Section 2.1</a></li>
<li><a href="#">Section 2.2</a></li>
<li><a href="#">Section 2.3</a></li>
</ul>
</li>
<li><a href="#" class="active">Section 3 ▾</a>
<ul>
<li><a href="#" class="active">Section 3.1</a></li>
<li><a href="#">Section 3.2 ▸</a>
<ul>
<li><a href="#">Section 3.2.1</a></li>
<li><a href="#">Section 3.2.2</a></li>
<li><a href="#">Section 3.2.3 ▸</a>
<ul>
<li><a href="#">Section 3.2.3.1</a></li>
<li><a href="#">Section 3.2.3.2</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#">Section 3.3</a></li>
</ul>
</li>
</ul>
</nav>