更改移动设备中的订单

时间:2016-08-18 22:38:57

标签: html css twitter-bootstrap

我制作了这个引导代码。但我无法弄清楚我在sm和xs视口上如何改变顺序,所以图片div在标题div下面。

有人知道我该怎么做吗?

https://plnkr.co/edit/yDwXuk1mia7JUVVEJ7kY?p=preview

  <body class="landingpage">
    <div class="background-image" style="background-image: url('http://www.planwallpaper.com/static/images/4-Nature-Wallpapers-2014-1_ukaavUI.jpg?anchor=center&amp;mode=crop&amp;width=2000&amp;height=1200&amp;rnd=131160348720000000');"></div>
    <div class="top-area" style="border: 4px solid red;">
      <div class="container">
        <div class="row">
          <div class="col-sm-4" style="border: 4px solid pink;">
            Logo
          </div>
            <div class="container">
              <div class="row">
                <div class="col-sm-12" style="border: 4px solid yellow;">
                  <p>Picture</p>
                </div>
                <div class="col-sm-6 col-sm-pull-6" style="border: 4px solid blue;">
                  <p class="header-xl center">
                    HEADLINE TEXT 
                  </p>
                  <p class="sub-header center">
                    Subline text
                  </p> 
                </div>
              </div>
            </div>
    </div>
  </body>
</html>

2 个答案:

答案 0 :(得分:3)

在标题下创建另一个div&#34; visible-sm&#34;和&#34; visible-xs&#34;上课并添加&#34; hidden-sm&#34;和&#34; hidden-xs&#34;到第一个div

  <body class="landingpage">
    <div class="background-image" style="background-image: url('http://www.planwallpaper.com/static/images/4-Nature-Wallpapers-2014-1_ukaavUI.jpg?anchor=center&amp;mode=crop&amp;width=2000&amp;height=1200&amp;rnd=131160348720000000');"></div>
    <div class="top-area" style="border: 4px solid red;">
      <div class="container">
        <div class="row">
          <div class="col-sm-4" style="border: 4px solid pink;">
            Logo
          </div>
            <div class="container">
              <div class="row">
                <div class="col-sm-12 hidden-sm hidden-xs" style="border: 4px solid yellow;">
                  <p>Picture</p>
                </div>
                <div class="col-sm-6 col-sm-pull-6" style="border: 4px solid blue;">
                  <p class="header-xl center">
                    HEADLINE TEXT 
                  </p>
                  <p class="sub-header center">
                    Subline text
                  </p> 
                </div>
                <div class="col-sm-12 visible-sm visible-xs" style="border: 4px solid yellow;">
                <p>Picture</p>
                </div>
              </div>
            </div>
    </div>
  </body>
</html>

编辑:Ricardo Ruiz在评论中的解决方案是一个更好的解决方案

答案 1 :(得分:2)

&#13;
&#13;
@media (max-width: 767px) {
  .sm-col-reorder { display: flex; flex-direction: column; }
  .sm-order-1 { order: 1; }
  .sm-order-2 { order: 2; }
}
&#13;
<div class="background-image" style="background-image: url('http://www.planwallpaper.com/static/images/4-Nature-Wallpapers-2014-1_ukaavUI.jpg?anchor=center&amp;mode=crop&amp;width=2000&amp;height=1200&amp;rnd=131160348720000000');"></div>
<div class="top-area" style="border: 4px solid red;">
  <div class="container">
    <div class="row">
      <div class="col-sm-4" style="border: 4px solid pink;">
        Logo
      </div>
      <div class="container">
        <div class="row sm-col-reorder">
          <div class="col-sm-12 sm-order-2" style="border: 4px solid yellow;">
            <p>Picture</p>
          </div>
          <div class="col-sm-6 col-sm-pull-6 sm-order-1" style="border: 4px solid blue;">
            <p class="header-xl center">
              HEADLINE TEXT
            </p>
            <p class="sub-header center">
              Subline text
            </p>
          </div>
        </div>
      </div>
    </div>
&#13;
&#13;
&#13;