简体   繁体   English

Bootstrap-列折叠时图像不环绕文本

[英]Bootstrap - Image not wrapping around text when columns collapse

I am having a problem with an image on the right breaks to a new line when the screen collapses to small and extra small in Twitter-Bootstrap 3. It remains on the right for medium and large size displays. 当屏幕在Twitter-Bootstrap 3中折叠成小屏幕和小屏幕时,右侧图像会换行,这是我的问题。对于中型和大型显示器,它仍然在右侧。 The first row is an image on the left where the text on the right remains wrapped the image as it collapses on all screen sizes and works fine - no problems. 第一行是左侧的图像,右侧的文本保留了该图像,因为它在所有屏幕尺寸上都可以折叠并且可以正常工作-没问题。 I want the second row shown below to have the text remain wrapped around the image on all display sizes as the first one does. 我希望下面显示的第二行使文本在所有显示尺寸上都像第一行一样保留在图像周围。 Can you help? 你能帮我吗? I'd be most grateful. 我将不胜感激。

    <div class="row">
       <div class="col-md-3 col-md-offset-1">
        <img src="images/my-image-on-the-left.jpg" alt="my image" width="219" height="148" align="left" />
       </div>  <!--col -->
        <div class="col-md-6"><p><br /> Text goes here and wraps around the image on left no problem</p>
         </div>  <!--col -->
     </div> <!-- row -->
  <br />
   <div class="row">
      <div class="col-md-6 col-md-offset-1">
     <p> Text goes here but only wraps around the image on the right on medium and large displays</p>
      </div><!--col -->
     <div class="col-md-3"> <img src="images/my-image-on-right.jpg" alt="image-right" width="246" height="259" align="right" /> </div><!--col --> 
   </div><!-- row -->

Add a media query for xs devices, and float the images so that the text wraps on mobile devices. 添加针对xs设备的媒体查询,然后浮动图像,以使文本在移动设备上自动换行。

@media (max-width: 768px) {
        .row img{
            float:left;
            margin:10px 0 10px 10px;
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM