Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CSS在一切之上的位置_Css - Fatal编程技术网

CSS在一切之上的位置

CSS在一切之上的位置,css,Css,我有一个fab菜单,我希望它位于数据表按钮的顶部。请参见屏幕截图(相对位置): CSS: .fab-menu { position: relative; display: inline-block; white-space: nowrap; padding: 0; margin: 0; list-style: none; z-index: 999; } 我尝试了position absolute,但fab菜单按钮放错了位置。请参见屏幕截图(绝对位置): 数据表滚

我有一个
fab菜单
,我希望它位于数据表按钮的顶部。请参见屏幕截图(相对位置):

CSS:

.fab-menu {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  padding: 0;
  margin: 0;
  list-style: none;
  z-index: 999;
}
我尝试了position absolute,但
fab菜单
按钮放错了位置。请参见屏幕截图(绝对位置):

数据表滚动换行的CSS:

.datatable-scroll-wrap {
  width: 100%;
  min-height: .01%;
  overflow-x: auto;
}
PS:如果我删除
溢出-x:auto按钮将显示在顶部,但如果我在下调整页面大小,则不会显示表格滚动条

.datatable-scroll-wrap {
  width: 100%;
  min-height: .01%;
  overflow-x: auto;
}
添加以下内容:

@media (max-width: 767px) {
    .datatable-scroll-wrap .dropdown-menu {
        position: absolute!important;
    }
}
@media (min-width: 768px) {
    .datatable-scroll-wrap {
        overflow: visible;
    }
}

你真正想要达到的目标是什么?如果您对z索引的工作方式有错误的假设,请提供更多的代码。这比你想象的要复杂得多。谷歌“z索引堆叠上下文”来获得一个想法。