简体   繁体   English

引导程序中的 2x2 图像网格设置高度/宽度 100%

[英]2x2 Image Grid in bootstrap setting height/width 100%

I'm struggling trying to make a responsive grid of 2x2 images in bootstrap.我正在努力尝试在引导程序中制作 2x2 图像的响应式网格。

I'd want the images to fill either the height or width of the browser.我希望图像填充浏览器的高度或宽度。 This is where i am stuck in bootstrap.这就是我被困在引导程序中的地方。

Code:代码:

<div class="container">
  <div class="row">
    <div class="col"><img id="Image1" class="img-fluid" src="9e6845.jpg"></div>
    <div class="col"><img id="Image2" class="img-fluid" src="6845.jpg"></div>
    <div class="w-100"></div>
    <div class="col"><img id="Image3" class="img-fluid" src="98d6e6845.jpg"></div>
    <div class="col"><img id="Image4" class="img-fluid" src="9e6845.jpg"></div>
  </div>
</div>

Issue:问题:

  • Container is set to max-width:1140px, so on taller screens i end up with empty space at bottom.容器设置为最大宽度:1140px,所以在较高的屏幕上,我最终会在底部留出空白空间。
  • If i set container max-width:100%, the width of the image pushes them out of the viewable area of the browser.如果我设置容器最大宽度:100%,图像的宽度会将它们推出浏览器的可视区域。
  • Am i better off using jQuery or similar getting the total height\width, then dividing it in 2 and setting the image sizes from that, or is there a way to do this with bootstrap/CSS/HTML.我最好使用 jQuery 或类似方法获取总高度\宽度,然后将其分成 2 并从中设置图像大小,或者有没有办法使用引导程序/CSS/HTML 来做到这一点。

Standard bootstrap container does not fill the width标准引导容器不填充宽度图像宽度示例 100% width pushes outside browser viewable area. 100% 宽度推到浏览器可视区域之外。 在此处输入图像描述

Please provide the resolution of your images.请提供您的图像的分辨率。 Kindly use proper ratio images.请使用适当比例的图像。 Do crop them accordingly.相应地裁剪它们。

You can read out about aspect ratios on many sites.您可以在许多网站上阅读有关纵横比的信息。 Here is the link where you can get the overview information.这是您可以获取概述信息的链接。

Aspect ratios 纵横比

Please also share clear pictures.也请分享清晰的图片。

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

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