自动化水平滚动瓷砖我想不JS
制造新闻水平滚动瓷砖滑盖纯CSS 创建不同的滚动纯CSS
我试着用flexbox,这
.spotlight-wrapper {
width: 100%;
overflow-x: auto;
}
.spotlight-wrapper .spotlight {
list-style: none;
height: 230px;
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: bottom;
padding: 0;
}
.spotlight-wrapper .spotlight li {
width: 220px;
height: 220px;
background: #ccc;
margin: 5px;
}
.spotlight-wrapper .spotlight li.small {
width: 105px;
height: 105px;
}
.spotlight-wrapper .spotlight li.medium {
width: 220px;
height: 105px;
/*
\t \t \t \t * Idea to fix it, but will cause
\t \t \t \t * issue if the medium tile in the
\t \t \t \t * bottom level, and there are 2 small
\t \t \t \t * tiles next to it in the top level
\t \t \t \t */
/* & + .small + .small{
\t \t \t \t \t display: block;
\t \t \t \t \t clear: both;
\t \t \t \t \t justify-content: bottom;
\t \t \t \t \t margin-top: 120px;
\t \t \t \t \t margin-left: -110px;
\t \t \t \t } */
}
.spotlight-wrapper .spotlight li.red {
background: red;
}
<div class="spotlight-wrapper">
\t <ul class="spotlight">
\t \t <li>Tile #1</li>
\t \t <li class="small">Tile #2</li>
\t \t <li class="small">Tile #3</li>
\t \t <li class="medium">Tile #9</li>
\t \t <li class="medium">Tile #10</li>
\t \t <li>Tile #2</li>
\t \t <li class="medium red">Tile #1</li>
\t \t <li class="small red">Tile #2</li>
\t \t <li class="small red">Tile #3</li>
\t \t <li>Tile #5</li>
\t \t <li>Tile #7</li>
\t \t <li>Tile #8</li>
\t \t <li class="medium">Tile #9</li>
\t \t <li class="medium">Tile #10</li>
\t \t <li>Tile #11</li>
\t \t <li>Tile #12</li>
\t \t <li class="small">Tile #13</li>
\t \t <li>Tile #14</li>
\t \t <li>Tile #15</li>
\t \t <li>Tile #16</li>
\t \t <li>Tile #17</li>
\t \t <li>Tile #18</li>
\t \t <li>Tile #19</li>
\t \t <li>Tile #20</li>
\t </ul>
但是,如果您检查红色瓷砖,它不正确的方式对齐,我可以使用边距修复它(检查com但是如果宽瓦片在最下面的行中,并且在下一个块中有2个小瓦片会引起其他问题,并且在下一个块中有2个小瓦片,
另外,如果只有一个小瓦片,则将创建空的空间。
您可能希望从这里开始您的故障排除:**'证明内容:bottom' **(有没有这样的值)。对于有效的值和其他对齐选项,可以帮助你在这里看到:[方法对齐Flex项目](http://stackoverflow.com/a/33856609/3597276) –
非常好的一个,感谢分享,希望答案亮起来有 –
也许列CSS更准确? http://codepen.io/anon/pen/pgEGvG –