html - 2 个带有中间 col-md 居中 Bootstrap 的侧边栏

标签 html twitter-bootstrap css

如何使用 bootstrap 使我的网站看起来像这样?我想要在容器的两侧有 2 个 300px 的侧边栏。我想在页面中间居中的中间栏。

   <!-- this is my middle column -->
    <div class="container content profile">
    <div class="row">
        <!-- Begin Content -->
        <div class="col-md-12">
        </div>
    </div> <!-- end row -->
    </div>

http://i.stack.imgur.com/irIrU.jpg

最佳答案

你可以这样试试,希望对你有帮助。

.mid-col{
  background: red;
}
.left-section{
  width: 300px;
  background: blue;
}
.right-section{
  width: 300px;
  background: green;
}
.profile .col-md-12.mid-col{
  width: calc(100% - 600px);
}

@media only screen and (max-width: 989px) {
  .profile .col-md-12.mid-col ,
  .left-section,
  .right-section{
        width: 100%;
        float: none !important;
        margin-bottom: 5px;
  }
}
<div class="container content profile">
      <div class="row">
            <!-- left section -->
            <div class="left-section pull-left">
                  L
            </div>
            <!-- left section -->
            <div class="col-md-12 mid-col">
                  M
            </div>
            <!-- right section -->
            <div class="left-section pull-right">
                  R
            </div>
            <!-- right section -->
      </div>
</div>

关于html - 2 个带有中间 col-md 居中 Bootstrap 的侧边栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31801414/

相关文章:

javascript - 如何缩小页面中间的导航栏并使其在滚动时粘在页面顶部?

c# - 如何将 HTML 分配给隐藏代码中的字符串?

css - SVG 图像模式如何在保持纵横比的情况下工作?

javascript - MEME 生成器(jQuery 和 CSS 帮助)

java - 使用websocket的最大连接数

css - Bootstrap 词缀不适用于 bootstrap 类

PHP + 代码点火器 : Bootstrap nav-link active for sub directory

javascript - 如何使用 JavaScript 和 CSS 创建弹出面板,没有库?

javascript - 拖动的组件不起作用

javascript - 带有页眉和页脚的 jQuery ListView