我想要单行(水平方式)对齐20幅图像. “inline-flex”属性在Firefox和chrome中工作,预计可以使用Safari.
<div class="rl-collection-img content" > <div class="rl-images_container"> <img alt="" src="/staticassets/images/home/collections/blue/1.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/2.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/3.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/4.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/5.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/6.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/7.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/8.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/9.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/10.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/11.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/12.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/15.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/16.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/17.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/18.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/19.jpeg" /> <img alt="" src="/staticassets/images/home/collections/blue/20.jpeg" /> </div> </div> <style> .content{ width:100%; } .rl-images_container{ display: inline-flex; }
解决方法
inline-flex中有一个浏览器特定的扩展.你需要做:
display: -webkit-inline-flex; display: -ms-inline-flexBox; display: inline-flex;