Is there a way in Bootstrap to “split” a column on small screens?

后端 未结 1 1141
半阙折子戏
半阙折子戏 2020-12-17 20:32

I\'m using Bootstrap 3. On large screens I want to have a sidebar on the left and the maincontent on the right. On small screens I want to have important blocks of the sideb

相关标签:
1条回答
  • 2020-12-17 20:33

    You could do something like this:

    Bootply Demo

    HTML:

    <div class="container-fluid">
      <div class="row">
        <div class="upper col-sm-3" style="background:red">
          <h3>I want to be <b>above</b> the main content on small screens!</h3>
        </div>
        <div class="col-sm-9 col-sm-pull-right">
          <h1>Main content</h1>
          <p>Lorem ipsum dolor sit amet</p>
          <p>Lorem ipsum dolor sit amet</p>
          <p>Lorem ipsum dolor sit amet</p>
          <p>Lorem ipsum dolor sit amet</p>
          <p>Lorem ipsum dolor sit amet</p>
        </div>    
        <div class="lower col-sm-3" style="background:green">
          <h3>I want to be <b>below</b> the main content on small screens!</h3>
        </div>
      </div>
    </div>
    

    CSS:

    @media (min-width: 768px) {
      .col-sm-pull-right {
          float: right;
      }
    }
    .lower {
      clear: left;
    }
    
    0 讨论(0)
提交回复
热议问题