css - 一个引导列中的 DIV 如何与另一列中的内容重叠?

标签 css bootstrap-4

我需要第一个 bootstrap 列中的一个 div 溢出 x 轴,我需要在其右侧的第二列上方查看其内容。

    <div class="row h-100">
        <div class="col-3 bg-info">
            <div class="LEFT">Content to be viewed</div>
        </div>
        <div class="col-9 bg-danger">Content that can be the shadow.</div>
    </div>
        div.row{
            overflow-x: auto;
        }
        div.col-3{
            overflow-x: visible;
            z-index:10;
        }
        div.popo{
            background-color: yellow;
            width:600px;
        }

我希望 LEFT div 在第二列 (col-9) 上可见。这可能吗?

最佳答案

<div class="row h-100">
  <div class="col-3 bg-info">
    <div class="LEFT">Content to be viewed</div>
  </div>
  <div class="col-9 bg-danger">Content that can be the shadow.</div>
</div>
.row {
  position: relative;
}
.bg-info {
  position: static;
}
.LEFT {
  position: absolute;
  text-align: center;
  top: 50%;
  right: calc( ( 4.5 / 12 ) * 100% );
  width: calc( ( 9 / 12 ) * 100% ) ;
  transform: translate(50%, -50%);
  z-index: 2;
  background-color: rgba( 1, 1, 1, .3);
}

https://codepen.io/Deykun/pen/GRKVYKZ

关于css - 一个引导列中的 DIV 如何与另一列中的内容重叠?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58206377/

相关文章:

css - Bootstrap 4 - 我们什么时候应该使用行?

javascript - 无法将最新的 bootstrap.js 上传到 iGEM wiki

javascript - 循环 css 背景

css - 为什么 slider 会挡住菜单?

html - Bootstrap 列大小等于特定列

css - 是否可以将 CSS 样式应用于列内的整行?

css - 删除了桌面 View 的右边距

css - Bootstrap 3 : Sticky Footer inside row/col class

javascript - OpenLayers - 在标记的矢量特征周围画一个框

javascript - 将汉堡图标添加到 Bootstrap 侧边栏