【问题标题】:Bootstrap col fixed position [duplicate]Bootstrap col固定位置[重复]
【发布时间】:2018-08-04 23:37:36
【问题描述】:

如何修复 Bootstrap col.

我试过这样但它不起作用:

<div class="row">
    <div class="col-md-6">Content goes here...</div> 
    <div class="col-md-6" style=" position: fixed">Content goes here...</div> 
</div>

fixed position 使 col 成为绝对位置。

当页面从顶部 400px 向下滚动时,如何禁用固定位置。

【问题讨论】:

  • 4.0 引导版

标签: html twitter-bootstrap css bootstrap-4


【解决方案1】:

使用媒体查询仅应用特定屏幕宽度上方的固定位置。例如 768px 是 Bootstrap 4 md 断点:

CSS(min-height 是可选的):

@media (min-width: 768px) {
    .fixed-posi {
        width: 50%;
        margin-left: 50%;
        min-height:100%;
        position:fixed;
    }
}

然后,在这样的布局中使用fixed-posi...

   <div class="row">
        <div class="col-md-6">
           Content goes here...
        </div>
        <div class="col-md-6 fixed-posi">Content goes here... (fixed position)
        </div>
   </div>

演示:https://www.codeply.com/go/751CygARyO

类似问题(左侧固定 DIV):How to left column fixed and right scrollable in Bootstrap 4, responsive?

【讨论】:

  • 但是如何解决这个问题
    内容在这里...
    内容在这里...
    内容在这里...
  • 这不是最初的问题。编辑原始问题
猜你喜欢
  • 1970-01-01
  • 2023-03-22
  • 2021-04-27
  • 1970-01-01
  • 2015-04-23
  • 2014-09-16
  • 2013-07-03
  • 2021-05-05
  • 1970-01-01
相关资源
最近更新 更多