css - 为什么按钮在使用相同类的特定 div 标签之间不起作用?

标签 css html twitter-bootstrap dom twitter-bootstrap-3

出于某种原因,按钮在特定 HTML 标记内时不起作用。它们不能被点击,即使在: A。应用的类与起作用的按钮完全相同,b。它们所在的标签也与有效的标签完全相同。下面的注释示例:

<header>
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
              <h3 class="text-left">The European What?</h3>
              <h4 class="text-left">The European Union</p>
              <p class="text-left">A bunch of important people from different countries gathered and thought it would be productive to work together. So now in Europe there are 28 countries that act like they’re one.</p>
              <!-- This button works -->
              <button class="btn lesson-toc" type="button" data-toggle="modal" data-target="#myModal"><i class="material-icons icon-align">list</i>Table of Contents</button>
            </div>
        </div>
    </div>
</header>
<section id="lesson" style="position:relative;overflow-y:scroll" data-spy="scroll" data-target="#toc">
    <div class="container">
      <div class="row">
        <!-- This button doesn't work -->
        <button class="btn lesson-toc" type="button" data-toggle="modal" data-target="#myModal">
          <i class="material-icons icon-align">list</i>
        </button>
        <div class="col-xs-12 text-center">
          <h5>How was the EU Formed? This is very long.</h5>
        </div>
      </div>
    </div>
    <!-- This button works -->
    <button class="btn lesson-toc" type="button" data-toggle="modal" data-target="#myModal">
      <i class="material-icons icon-align">list</i>
    </button>

最佳答案

我发现 .lesson-toc 类有一个 CSS 属性 position: absolute;并且 z-index 将它推到其他东西下面,所以它变得不可点击。它只在那个特定的 div 中被破坏,因为在其他 div 中,没有更高的 z-index 值来覆盖它。

关于css - 为什么按钮在使用相同类的特定 div 标签之间不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41153193/

相关文章:

html - 导航栏右侧部分折叠

javascript - JS保持与iFrame内容相关的菜单的事件状态

html - 使 div 高度延伸到另一个 div

jquery - 如何使用 jQuery 删除 Bootstrap Multiselect 中的所有选项?

twitter-bootstrap - 导航栏,bootstrap的页眉和页脚,所有页面通用

html - 将小元素放在标题下方,但保持垂直对齐

javascript - 单击 div 时运行函数

android - 在全屏模式下显示状态栏 Ionic for android 和 iOS

javascript - 使用 JSON 更改显示的数字或字符串?

html - 宽度问题,响应式移动设计