title: Multi- level dropdown using BootStrap-4 navbar goes out of screen when dropsdown
body: <p>i just can't get this to work.I uses BS4 for responsiveness. my navs are right aligned in the navbar. I tried so many things to position the submenu at the left of the parent menu... but then it does not display submenu. the same problem arises when Sub-submenu dropdowns</p>
  
  <p>HTML code follows:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;!-- Style Sheets Attaches Here--&gt;
      &lt;link rel="stylesheet" href="css/bootstrap.min.css"&gt;
      &lt;link rel="stylesheet" href="css/multi-navbar.css"&gt;
      &lt;!-- Style Sheets Ends Here--&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
      &lt;nav class="navbar navbar-expand-lg bg-dark navbar-dark fixed-top"&gt;
          &lt;img src="assets/logo.jpg" class="rounded" alt="Logo" style="width:40px;"&gt;
          &lt;a class="navbar-brand" href="#"&gt;&amp;nbsp;&amp;nbsp;NavBar&lt;/a&gt;
          &lt;button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation"&gt;
              &lt;span class="navbar-toggler-icon"&gt;&lt;/span&gt;
          &lt;/button&gt;
          &lt;div id="navbarNavDropdown" class="navbar-collapse collapse justify-content-end"&gt;
              &lt;ul class="navbar-nav nav-pills nav-fill"&gt;
                  &lt;li class="nav-item active"&gt;
                      &lt;a class="nav-link" href="#"&gt;Home &lt;span class="sr-only"&gt;(current)&lt;/span&gt;&lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li class="nav-item dropdown"&gt;
                      &lt;a class="nav-link dropdown-toggle" href="" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"&gt;Dropdown1&lt;/a&gt;
                      &lt;ul class="dropdown-menu " aria-labelledby="navbarDropdownMenuLink"&gt;
                          &lt;li&gt;
                              &lt;a class="dropdown-item" href="#"&gt;menu1&lt;/a&gt;
                          &lt;/li&gt;
                          &lt;li&gt;
                              &lt;a class="dropdown-item" href="#"&gt;menu2&lt;/a&gt;
                          &lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
                  &lt;li class="nav-item dropdown"&gt;
                      &lt;a class="nav-link dropdown-toggle" href="" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"&gt;Dropdown2&lt;/a&gt;
                      &lt;ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"&gt;
                          &lt;li class="dropdown-submenu"&gt;
                              &lt;a class="dropdown-item dropdown-toggle" href="#"&gt;menu1&lt;/a&gt;
                              &lt;ul class="dropdown-menu"&gt;
                                  &lt;li&gt;
                                      &lt;a class="dropdown-item" href="#"&gt;Submenu 1&lt;/a&gt;
                                  &lt;/li&gt;
                                  &lt;li&gt;
                                      &lt;a class="dropdown-item" href="#"&gt;Submenu 2&lt;/a&gt;
                                  &lt;/li&gt;
                              &lt;/ul&gt;
                          &lt;/li&gt;
                          &lt;li class="dropdown-submenu"&gt;
                              &lt;a class="dropdown-item dropdown-toggle" href="#"&gt;menu2/a&gt;
                              &lt;ul class="dropdown-menu"&gt;
                                  &lt;li&gt;
                                      &lt;a class="dropdown-item" href="#"&gt;Submenu 1&lt;/a&gt;
                                  &lt;/li&gt;
                                  &lt;li&gt;
                                      &lt;a class="dropdown-item" href="#"&gt;Submenu 2&lt;/a&gt;
                                  &lt;/li&gt;
                              &lt;/ul&gt;
                          &lt;/li&gt;
  
                          &lt;li class="dropdown-divider"&gt;&lt;/li&gt;
                          &lt;li class="dropdown-submenu"&gt;
                              &lt;a class="dropdown-item dropdown-toggle" href="#"&gt;Another&lt;/a&gt;
                              &lt;ul class="dropdown-menu"&gt;
                                  &lt;li class="dropdown-submenu"&gt;
                                      &lt;a class="dropdown-item dropdown-toggle" href="#"&gt;Submenu 1&lt;/a&gt;
                                      &lt;ul class="dropdown-menu"&gt;
                                          &lt;li&gt;
                                              &lt;a class="dropdown-item" href="#"&gt;Sub-submenu1&lt;/a&gt;
                                          &lt;/li&gt;
                                          &lt;li&gt;
                                              &lt;a class="dropdown-item" href="#"&gt;Sub-submenu1&lt;/a&gt;
                                          &lt;/li&gt;
                                      &lt;/ul&gt;
                                  &lt;/li&gt;
                                  &lt;li class="dropdown-submenu"&gt;
                                      &lt;a class="dropdown-item dropdown-toggle" href="#"&gt;Submenu 2&lt;/a&gt;
                                      &lt;ul class="dropdown-menu"&gt;
                                          &lt;li&gt;
                                              &lt;a class="dropdown-item" href="#"&gt;Subsubmenu2&lt;/a&gt;
                                          &lt;/li&gt;
                                          &lt;li&gt;
                                              &lt;a class="dropdown-item" href="#"&gt;Subsubmenu2&lt;/a&gt;
                                          &lt;/li&gt;
                                      &lt;/ul&gt;
                                  &lt;/li&gt;
                              &lt;/ul&gt;
                          &lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
                  &lt;li class="nav-item dropdown"&gt;
                      &lt;a class="nav-link dropdown-toggle" href="" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"&gt;Dropdown3&lt;/a&gt;
                      &lt;ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"&gt;
                          &lt;li class="dropdown-submenu "&gt;
                              &lt;a class="dropdown-item dropdown-toggle" href="#"&gt;menu1&lt;/a&gt;
                              &lt;ul class="dropdown-menu dropdown-menu-right"&gt;
                                  &lt;li&gt;
                                      &lt;a class="dropdown-item" href="#"&gt;Submenu 1&lt;/a&gt;
                                  &lt;/li&gt;
                                  &lt;li&gt;
                                      &lt;a class="dropdown-item" href="#"&gt;Submenu 2&lt;/a&gt;
                                  &lt;/li&gt;
                              &lt;/ul&gt;
                          &lt;/li&gt;
                          &lt;li class="dropdown-divider"&gt;&lt;/li&gt;
                          &lt;li class="dropdown-submenu"&gt;
                              &lt;a class="dropdown-item dropdown-toggle" href="#"&gt;Yet Another&lt;/a&gt;
                              &lt;ul class="dropdown-menu dropdown-menu-right"&gt;
                                  &lt;li class="dropdown-submenu"&gt;
                                      &lt;a class="dropdown-item dropdown-toggle" href="#"&gt;Submenu 1&lt;/a&gt;
                                      &lt;ul class="dropdown-menu"&gt;
                                          &lt;li&gt;
                                              &lt;a class="dropdown-item" href="#"&gt;Sub1-submenu 1&lt;/a&gt;
                                          &lt;/li&gt;
                                          &lt;li&gt;
                                              &lt;a class="dropdown-item" href="#"&gt;Sub1-submenu 2&lt;/a&gt;
                                          &lt;/li&gt;
                                      &lt;/ul&gt;
                                  &lt;/li&gt;
                                  &lt;li class="dropdown-submenu"&gt;
                                      &lt;a class="dropdown-item dropdown-toggle" href="#"&gt;Submenu 2&lt;/a&gt;
                                      &lt;ul class="dropdown-menu"&gt;
                                          &lt;li&gt;
                                              &lt;a class="dropdown-item" href="#"&gt;Sub2-submenu 1&lt;/a&gt;
                                          &lt;/li&gt;
                                          &lt;li&gt;
                                              &lt;a class="dropdown-item" href="#"&gt;Sub2-submenu 2&lt;/a&gt;
                                          &lt;/li&gt;
                                      &lt;/ul&gt;
                                  &lt;/li&gt;
                              &lt;/ul&gt;
                          &lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
                  &lt;li class="nav-item"&gt;
                      &lt;a class="nav-link" href=""&gt;Login&lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li class="nav-item"&gt;
                      &lt;a class="nav-link" href=""&gt;Register&lt;/a&gt;
                  &lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
      &lt;/nav&gt;
      &lt;!-- Navbar completed Here--&gt;
  
  
      &lt;!-- Javascript Loads Here--&gt;
      &lt;script src="js/jquery-3.3.1.min.js"&gt;&lt;/script&gt;
      &lt;script src="js/popper.min.js"&gt;&lt;/script&gt;
      &lt;script src="js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>CSS - multi-navbar.css</p>
  
  <pre><code>.navbar-nav li:hover &gt; ul.dropdown-menu {
      display: block;
  }
  .dropdown-submenu {
      position:relative;
  }
  .dropdown-submenu&gt;.dropdown-menu {
      top:0;left:100%;margin-top:-6px;
  }
  /* rotate caret on hover */
  .dropdown-menu &gt;li &gt; a:hover:after {
      text-decoration: underline;
      transform: rotate(-90deg);
  } 
  </code></pre>
  
  <p>These are the codes i used other than Bootstrap-4
  Please help me</p>