Bootstrap Grid with HTML5 Sections and Aside

流过昼夜 提交于 2021-01-05 23:48:16

问题


I am using the Bootstrap 4 grid system, and want to float an aside down the right hand side of the screen.

Currently my MAIN content is wrapped in col-xl-3, I want the ASIDE to also use col-xl-3, but I want it to run the height of the page, not just the height of the row it is in, as it is currently pushing the height of the row out...

As you can see from the image, my aside is pushing the top row higher than the bottom...

All I have done code wise is this;

section.body article, section.body aside { float: left; clear: both; }

Any help would be greatly appreciated.


回答1:


I used "col-sm" but the principle is still the same. It's all about the nesting.

View in full page to see columns.

<html>
<head>
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
</head>
<body>
    <div class="container" role="main">
      <div class="row">
          <div class="col-sm-8">
              <div class="row">
                  <div class="col-sm-4">1</div>
                  <div class="col-sm-4">2</div>
                  <div class="col-sm-4">3</div>
                  <div class="col-sm-4">4</div>
                  <div class="col-sm-4">5</div>
                  <div class="col-sm-4">6</div>
              </div>
          </div>
        <div class="col-sm-4">
          <div class="row">Nav</div>
          <div class="row">Nav</div>
          <div class="row">Nav</div>
          <div class="row">Nav</div>
          <div class="row">Nav</div>
        </div>
      </div>
    </div>
</body>
</html>


来源:https://stackoverflow.com/questions/36161615/bootstrap-grid-with-html5-sections-and-aside

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!