CoreUI 旁边的菜单漂浮在主菜单上

CoreUI aside menu floating over main

我正在使用管理模板 CoreUI。我的布局是页面 https://coreui.io/v1/docs/layout/options/

中描述的基本布局

我正在尝试让右侧的侧边菜单打开浮动在主要内容上而不是内联减小宽度主要的。

我尝试删除 aside-menu-fixed,添加 aside-menu-floating 或 absolute,但它不起作用。

有没有不修改 CoreUI 的方法css?

下面是代码片段,但它在 SO 上不起作用

.app-header{background-color:#4B8BF4}
.sidebar{background-color:#FFCD42}
.app-footer{background-color:#DD4F43}
.aside-menu{background-color:#19A15F}
.main{background-color:#EEE}
<link href="https://cdn.jsdelivr.net/npm/@coreui/coreui@2.1.7/dist/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdn.jsdelivr.net/npm/@coreui/coreui@2.1.7/dist/css/coreui.min.css" rel="stylesheet"/>

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@coreui/coreui@2.1.7/dist/js/coreui.min.js"></script>



<body class="app header-fixed sidebar-fixed aside-menu-fixed sidebar-lg-show">
  <header class="app-header navbar">
    <!-- Header content here -->
    <h2>I'm the header!</h2>
  </header>
  <div class="app-body">
    <div class="sidebar">
      <!-- Sidebar content here -->
      <nav class="sidebar-nav">
                <ul class="nav">
                    <li class="nav-item">
                        <a class="nav-link" href="index.html">
                            <i class="nav-icon icon-speedometer"></i> Dashboard
                        </a>
                    </li>
                    <li class="nav-title">Settings</li>
                </ul>
            </nav>
    </div>
    <main class="main">
      <h1>I'm the main content...</h1>
    </main>
    <aside class="aside-menu">
      <!-- Aside menu content here -->
    </aside>
  </div>
  <footer class="app-footer">
    <!-- Footer content here -->
  </footer>
</body>

body 元素:

  • 添加classaside-menu-off-canvas
  • 并删除 class aside-menu-fixed

hth