【问题标题】:How to handle multiple images in a row in bootstrap form?如何以引导程序形式连续处理多个图像?
【发布时间】:2018-09-06 16:03:50
【问题描述】:

我想在引导程序中处理行。请检查我在做什么:

<div class="form-group col-md-6">

   <?php if($saved_image != ''): ?>

          <div style="width:100px; height:100px">
            <img class="img-thumb" src="<?=$saved_image;?>" alt="saved image" />
            <br>
            <a href="products.php?delete_image=1&edit=<?=$edit_id;?>" class="text-danger">Delete Image</a>

            <!-- Start Another image 2 -->
              <img class="img-thumb" src="<?=$saved_image;?>" alt="saved image" />
              <br>
              <a href="products.php?delete_image=1&edit=<?=$edit_id;?>" class="text-danger">Delete Image</a>
            <!-- End Another image 2 -->

        </div>
        <!-- If Edit Happen - End -->
      <?php else:?>
       <!-- If image empty or user first time add product[data is not saved in the database] -->
       <label for="photo">Product Photo:</label>
       <input class="form-control" type="file" name="photo[]" id="photo" multiple>
     <?php endif;?>

   </div>   <!-- close form-group div -->

          <div class="form-group col-md-6">
          <label for="description">Description:</label>
          <textarea class="form-control" name="description" id="description" rows="6"><?= $description ;?></textarea>
          </div>

请检查下图我得到的输出:

我希望熨斗图像彼此相邻显示,如果有更多图像,它将显示在下一行,但不在描述框下方。描述框将始终存在于它现在显示的位置。

请提出我做错了什么。欢迎您提出建议。

【问题讨论】:

  • 试试
  • na 不要使用width:100px; height:100px; shenanigins,而是只使用另一组行/列,好像你忘记了你在使用引导程序
  • @Dr J Manish 感谢您的帮助,但不幸的是没有工作!

标签: php jquery html twitter-bootstrap bootstrap-4


【解决方案1】:

您可以在现有代码中尝试使用更多 div 标签。

<div class="form-group col-md-6">

 <?php if($saved_image != ''): ?>

      <div class="col-md-6"><!-- This is EDITED-->
        <img class="img-thumb" src="<?=$saved_image;?>" alt="saved image" />
        <br>
        <a href="products.php?delete_image=1&edit=<?=$edit_id;?>" class="text-danger">Delete Image</a>
     </div> <!-- This Is ADDED NEWLY-->
      <div class="col-md-6"> <!-- This Is ADDED NEWLY-->
        <!-- Start Another image 2 -->
          <img class="img-thumb" src="<?=$saved_image;?>" alt="saved image" />
          <br>
          <a href="products.php?delete_image=1&edit=<?=$edit_id;?>" class="text-danger">Delete Image</a>
        <!-- End Another image 2 -->
       </div> <!-- This Is ADDED NEWLY-->
    </div>
    <!-- If Edit Happen - End -->
  <?php else:?>
   <!-- If image empty or user first time add product[data is not saved in the database] -->
   <label for="photo">Product Photo:</label>
   <input class="form-control" type="file" name="photo[]" id="photo" multiple>
 <?php endif;?>

【讨论】:

    猜你喜欢
    相关资源
    最近更新 更多
    热门标签