• <small id='54LqA'></small><noframes id='54LqA'>

  • <tfoot id='54LqA'></tfoot>
  • <i id='54LqA'><tr id='54LqA'><dt id='54LqA'><q id='54LqA'><span id='54LqA'><b id='54LqA'><form id='54LqA'><ins id='54LqA'></ins><ul id='54LqA'></ul><sub id='54LqA'></sub></form><legend id='54LqA'></legend><bdo id='54LqA'><pre id='54LqA'><center id='54LqA'></center></pre></bdo></b><th id='54LqA'></th></span></q></dt></tr></i><div id='54LqA'><tfoot id='54LqA'></tfoot><dl id='54LqA'><fieldset id='54LqA'></fieldset></dl></div>

      <legend id='54LqA'><style id='54LqA'><dir id='54LqA'><q id='54LqA'></q></dir></style></legend>
        <bdo id='54LqA'></bdo><ul id='54LqA'></ul>

        如何用不同大小的图像创建网格?

        时间:2023-07-31
        <legend id='HB8V8'><style id='HB8V8'><dir id='HB8V8'><q id='HB8V8'></q></dir></style></legend>
          <tbody id='HB8V8'></tbody>
        • <i id='HB8V8'><tr id='HB8V8'><dt id='HB8V8'><q id='HB8V8'><span id='HB8V8'><b id='HB8V8'><form id='HB8V8'><ins id='HB8V8'></ins><ul id='HB8V8'></ul><sub id='HB8V8'></sub></form><legend id='HB8V8'></legend><bdo id='HB8V8'><pre id='HB8V8'><center id='HB8V8'></center></pre></bdo></b><th id='HB8V8'></th></span></q></dt></tr></i><div id='HB8V8'><tfoot id='HB8V8'></tfoot><dl id='HB8V8'><fieldset id='HB8V8'></fieldset></dl></div>

              <tfoot id='HB8V8'></tfoot>
              • <bdo id='HB8V8'></bdo><ul id='HB8V8'></ul>
              • <small id='HB8V8'></small><noframes id='HB8V8'>

                  本文介绍了如何用不同大小的图像创建网格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试创建一个图像网格,其中一行的所有图像共享相同的高度,并且每行使用相同的宽度.

                  I'm trying to create a grid of images where all images of a row share the same height and where each row uses the same width.

                  我该怎么做?哪些库可以帮助我?

                  How can I do this and what libraries can help me?

                  推荐答案

                  这种类型的网格很难自己制作,所以最好不要重新发明轮子,而是使用互联网上很棒的人创建的很棒的库.

                  This type of grid are difficult to make by yourself so its better to not reinvent the wheel and use awesome libraries created by awesome people on the internet.

                  查看最适合您所寻找内容的链接 -->

                  Checkout this links which are best for what you are looking for -- >

                  1. http://masonry.desandro.com/
                  2. http://css-tricks.com/seamless-responsive-photo-grid/

                  还有这个链接 http://www.jqueryscript.net/tags.php?/grid%20layout/ 有各种可能有用的图像网格视图库..

                  Also this link http://www.jqueryscript.net/tags.php?/grid%20layout/ has a variety of those image grid view libraries which may be useful ..

                  事实上,CSS 技巧链接是一个免费的简单实现.我们的想法是将图像宽度设置为 100% 并将您的空间划分为列.

                  The CSS trick link is, in fact, a library free easy implementation. The idea is to set images width to 100% and divide your space into columns.

                  这是从上一个链接中提取的片段:

                  Here is a snippet extracted from the previous link:

                  function getRandomSize(min, max) {
                    return Math.round(Math.random() * (max - min) + min);
                  }
                  
                  var allImages = "";
                  
                  for (var i = 0; i < 25; i++) {
                    var width = getRandomSize(200, 400);
                    var height = getRandomSize(200, 400);
                    allImages += '<img src="https://placekitten.com/' + width + '/' + height + '" alt="pretty kitty">';
                  }
                  
                  photos.innerHTML = allImages

                  .snippet-result-code {
                    height: 500px
                  }
                  
                  #photos {
                    /* Prevent vertical gaps */
                    line-height: 0;
                    -webkit-column-count: 5;
                    -webkit-column-gap: 0px;
                    -moz-column-count: 5;
                    -moz-column-gap: 0px;
                    column-count: 5;
                    column-gap: 0px;
                  }
                  
                  #photos img {
                    /* Just in case there are inline attributes */
                    width: 100% !important;
                    height: auto !important;
                  }
                  
                  @media (max-width: 1200px) {
                    #photos {
                      -moz-column-count: 4;
                      -webkit-column-count: 4;
                      column-count: 4;
                    }
                  }
                  
                  @media (max-width: 1000px) {
                    #photos {
                      -moz-column-count: 3;
                      -webkit-column-count: 3;
                      column-count: 3;
                    }
                  }
                  
                  @media (max-width: 800px) {
                    #photos {
                      -moz-column-count: 2;
                      -webkit-column-count: 2;
                      column-count: 2;
                    }
                  }
                  
                  @media (max-width: 400px) {
                    #photos {
                      -moz-column-count: 1;
                      -webkit-column-count: 1;
                      column-count: 1;
                    }
                  }
                  
                  body {
                    margin: 0;
                    padding: 0;
                  }

                  <section id="photos"></section>

                  这篇关于如何用不同大小的图像创建网格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 javascript/jQuery 查找最接近鼠标位置的网格坐标 下一篇:是否有适用于 Webkit 的 CSS3 网格布局的有效实现?

                  相关文章

                1. <legend id='h5a1s'><style id='h5a1s'><dir id='h5a1s'><q id='h5a1s'></q></dir></style></legend>
                  • <bdo id='h5a1s'></bdo><ul id='h5a1s'></ul>

                    <i id='h5a1s'><tr id='h5a1s'><dt id='h5a1s'><q id='h5a1s'><span id='h5a1s'><b id='h5a1s'><form id='h5a1s'><ins id='h5a1s'></ins><ul id='h5a1s'></ul><sub id='h5a1s'></sub></form><legend id='h5a1s'></legend><bdo id='h5a1s'><pre id='h5a1s'><center id='h5a1s'></center></pre></bdo></b><th id='h5a1s'></th></span></q></dt></tr></i><div id='h5a1s'><tfoot id='h5a1s'></tfoot><dl id='h5a1s'><fieldset id='h5a1s'></fieldset></dl></div>
                    1. <tfoot id='h5a1s'></tfoot>

                      <small id='h5a1s'></small><noframes id='h5a1s'>