首页 > 解决方案 > 定位时按钮不可用

问题描述

我有一个按钮,里面有几个级别的 div。每当我尝试定位按钮时,它不再可用。它变为禁用状态。我试图将 z-index 设置为 9999,但没有成功。我还将按钮包装在 div 中并定位 div 本身,但它仍然禁用按钮。我尝试更改边距并浮动。

#left_menu {
  position: fixed;
  width: 12%;
  height: 100%;
  background-color: #262626;
  border-right: 3px solid #1a1a1a;
}

#left_menu_top_options {
  width: 100%;
  height: 30px;
  background-color: #1a1a1a;
}

.left_menu_button {
  position: relative;
  float: right;
  width: 25px;
  height: 25px;
  z-index: 9999;
}
<div id='left_menu' class='lmenu'>
  <div id='left_menu_top_options'>
    <button class="left_menu_button" onclick="changeMenu()">C</button>
  </div>
</div>

标签: htmlcssdisplay

解决方案


不知道是什么导致了这个问题。作为解决方案,我从左侧菜单中删除了该类,并创建了一个完全独立的固定 div 来使用按钮。这很有效。


推荐阅读