I'm currently utilizing Bootstrap 4 with a multilevel dropdown feature as shown in the image below: https://i.sstatic.net/xgVLp.png
My goal is to shift the submenus to the left side, in the opposite direction from how they are currently displayed. Despite applying various classes such as dropdown-menu-left
, pull-left
, and dropleft
, the submenu direction remains unchanged. I also attempted to override the dropdown-menu class without success.
.dropdown-menu {
left: auto;
right: 0;
}
Could anyone provide a suggestion on the correct class in Bootstrap 4 to achieve the desired effect of pulling the submenu to the left? I've tried solutions from other discussions here, but none seem to work for me. Thank you in advance.
Below is an excerpt of my code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Bootstrap 4 Navbar With Multilevel Dropdowns Example</title>
<link href="https://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/4.3.1/lumen/bootstrap.min.css">
<style>
.dropdown-submenu {
position: relative;
}
.dropdown-submenu a::after {
transform: rotate(-90deg);
position: absolute;
right: 6px;
top: .8em;
}
.dropdown-submenu .dropdown-menu {
top: 0;
left: 100%;
margin-left: .1rem;
margin-right: .1rem;
}
</style>
</head>
<body>
<!-- Code continues... -->
</body>
</html>