Is it possible to choose the stacking order of spans?

后端 未结 1 1892
忘了有多久
忘了有多久 2021-01-02 05:08

I\'m starting a project with Twitter Bootstrap, and quite like the responsive css, making the spans stack on top of each other when the viewport gets smaller.

Given

相关标签:
1条回答
  • 2021-01-02 05:43

    HTML

    Wrap your content with .container, put that big block on the first place, add .pull-right so it will appear right:

    <div class="container">
      <div class="row">
        <div class="span4 pull-right">
          <img src="http://placehold.it/280x180">
        </div>
        <div class="span8">
          <!-- ... -->
        </div>
      </div>
    </div>
    

    CSS

    When on mobile, place it where it should be with float:none:

    @media (max-width: 767px) {
      [class*="span"].pull-right {
        float: none;
    }
    

    Here's fiddle, I'll hope it works like you want it.

    0 讨论(0)
提交回复
热议问题