Bootstrap在移动视图中重新排序图像和文本

时间:2017-03-10 06:06:39

标签: html css twitter-bootstrap mobile responsive

My output image here

我有这个代码有替代图像和文字但在移动设备中它应该是文字和图片/文字和图片但我得到的是文字和图片/图片和文字

[1]<!-- Project One -->
<div class="row">
    <div class="col-md-6">
        <h3>Project One</h3>
        <h4>Subheading</h4>
        <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.Laudantium veniam exercitationem expedita laborum at voluptate. Labore, voluptates totam at aut nemo deserunt rem magni pariatur quos perspiciatis atque eveniet unde.</p>
          <a class="btn btn-primary" href="#">View Project <span class="glyphicon glyphicon-chevron-right"></span></a>

    </div>
    <div class="col-md-6">
         <a href="#">
            <img class="img-responsive" src="http://placehold.it/700x300" alt="">
         </a>

     </div>
</div>
<!-- /.row -->

<hr>

<!-- Project Two -->
<div class="row">
     <div class="col-md-6">
         <a href="#">
            <img class="img-responsive" src="http://placehold.it/700x300" alt="">
         </a>
     </div>
     <div class="col-md-6">
          <h3>Project Two</h3>
          <h4>Subheading</h4>
          <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut, odit velit cumque vero doloremque repellendus distinctio maiores rem expedita a nam vitae modi quidem similique ducimus! Velit, esse totam tempore.</p>
          <a class="btn btn-primary" href="#">View Project <span class="glyphicon glyphicon-chevron-right"></span></a>
     </div>
 </div>
 <!-- /.row -->

my output is here

2 个答案:

答案 0 :(得分:1)

添加img然后text并使用pull-rightpull-left类进行对齐。

&#13;
&#13;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class=container>
  <div class="row clearfix">
   <div class="col-md-6 pull-right">
      <a href="#">
        <img class="img-responsive" src="http://placehold.it/700x300" alt="">
      </a>

    </div>
    <div class="col-md-6 pull-left">
      <h3>Project One</h3>
      <h4>Subheading</h4>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.Laudantium veniam exercitationem expedita laborum at voluptate. Labore, voluptates totam at aut nemo deserunt rem magni pariatur quos perspiciatis atque eveniet unde.</p>
      <a class="btn btn-primary" href="#">View Project <span class="glyphicon glyphicon-chevron-right"></span></a>

    </div>
  </div>
  <!-- /.row -->

  <hr>

  <!-- Project Two -->
  <div class="row">
    <div class="col-md-6">
      <a href="#">
        <img class="img-responsive" src="http://placehold.it/700x300" alt="">
      </a>
    </div>
    <div class="col-md-6">
      <h3>Project Two</h3>
      <h4>Subheading</h4>
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ut, odit velit cumque vero doloremque repellendus distinctio maiores rem expedita a nam vitae modi quidem similique ducimus! Velit, esse totam tempore.</p>
      <a class="btn btn-primary" href="#">View Project <span class="glyphicon glyphicon-chevron-right"></span></a>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

你需要将类push-xs-6添加到div上面的图像(你有col-md-6)和pull-xs-6到div上面的文本。它将在宽度<768px

的设备上交换位置