简体   繁体   English

如何使用2 col-md-6同时适合文本和图像

[英]how to fit both text and image in a row using 2 col-md-6

 <style> .backgroundcolor1 { background-color: #567892; } </style> 
 <section> <div class="row" align="center"> <div class="col-md-12 backgroundcolor1"> <div class="col-md-6 col-sm-6"> <div class="col-md-10 col-lg-offset-1 "> <br> <img src="assets/images/SPA/Icons/facials.png" class="icons" alt=""><br> <h3>FACIALS</h3> <p align="justify">Have you ever treated to a facial?<br> Facial treatments feel good, offering soothing relaxation, according to Day Spas. Facial massage treatments increase circulation and the flow of blood, and they include a variety of cremes, aromatherapy and oils that moisturize the skin, smell good, and relieve stress as well as encourage peace of mind and contentment</p> </div> </div> <div class="col-md-6 col-sm-6 textbox"> <img src="assets/images/SPA/facial.jpg" style="height: 100%; width: 100%; object-fit: contain;opacity:0.9;padding:0;margin:0; " alt=""> <figcaption><br><br><br> <h3>Facials</h3> </figcaption> [enter image description here][1] </div> </div> </div> </section> 

I am getting proper image fitting to text.. after i start resizing my image start reducing and there will be gap like the below image. 我得到的图像适合文本..开始调整大小后,我的图像开始缩小,并且会出现如下图所示的间隙。 i don't want it to happen for all the devices. 我不希望所有设备都发生这种情况。 my entire site is in this manner only. 我的整个网站仅以这种方式。 i don't want that extra background showing at the right side of the image.can anybody help me to solve this problem. 我不希望在图像的右侧显示多余的背景。有人可以帮助我解决此问题吗?

图片

you can create row inside col-md-6 and define column that you want like 您可以在col-md-6内创建行并定义所需的列

<div class="col-md-6 col-sm-6 textbox">
   <div class="row">
      <div class="col-md-7 col-sm-6">
          <img src="">
      </div>
      <div class="col-md-5 col-sm-6">
          <p>Text goes here.....</p>
          <p>ddescription goes here</p>
      </div>
   </div>
</div>

you can print text first and image in second and change col length with your need. 您可以先打印文本,然后再打印图像,并根据需要更改列长。 I hope this is what you need if not please try to clarify your question. 我希望这是您所需要的,如果不需要的话,请尝试澄清您的问题。

Please check this 请检查一下

 .backgroundcolor1 { background-color: #567892; } .back_imag{position:absolute !important; background:url(http://via.placeholder.com/500x400) no-repeat; background-size:cover; background-position:center center; left:0px; top:0px; bottom:0px; } 
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/> <section class="container"> <div class="row" align="center"> <div class="col-xs-12 backgroundcolor1"> <div class="col-xs-6 col-sm-6"> <div class="col-md-10 col-lg-offset-1 "> <br> <img src="assets/images/SPA/Icons/facials.png" class="icons" alt=""><br> <h3>FACIALS</h3> <p align="justify">Have you ever treated to a facial?<br> Facial treatments feel good, offering soothing relaxation, according to Day Spas. Facial massage treatments increase circulation and the flow of blood, and they include a variety of cremes, aromatherapy and oils that moisturize the skin, smell good, and relieve stress as well as encourage peace of mind and contentment</p> </div> </div> <div class="col-xs-6 col-sm-6 textbox back_imag col-xs-offset-6"> <img src="" class="" alt=""> <figcaption><br><br><br> <h3>Facials</h3> </figcaption> [enter image description here][1] </div> </div> </div> </section> 

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

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