css – Flexbox / IE11:flex-wrap:wrap不包装(Image Codepen里面)

栏目: CSS · 发布时间: 7年前

内容简介:我创建了一个列有社交图标的列表.那些图标应该放在小屏幕上.我使用flex-wrap:wrap;它在Firefox和Chrome中完美无缺:但Internet Explorer 11(和IE 10)不会打破这一行:

我创建了一个列有社交图标的列表.那些图标应该放在小屏幕上.

我使用flex-wrap:wrap;它在Firefox和Chrome中完美无缺:

但Internet Explorer 11(和IE 10)不会打破这一行:

代码笔示例

查看代码: http://codepen.io/dash/pen/PqOJrG

HTML代码

<div>
  <ul>
    <li><a href="#"><img src="http://placehold.it/40x40" alt=""></a></li>
    <li><a href="#"><img src="http://placehold.it/40x40" alt=""></a></li>
    <li><a href="#"><img src="http://placehold.it/40x40" alt=""></a></li>
    <li><a href="#"><img src="http://placehold.it/40x40" alt=""></a></li>
    <li><a href="#"><img src="http://placehold.it/40x40" alt=""></a></li>
    <li><a href="#"><img src="http://placehold.it/40x40" alt=""></a></li>
    <li><a href="#"><img src="http://placehold.it/40x40" alt=""></a></li>
    <li><a href="#"><img src="http://placehold.it/40x40" alt=""></a></li>
  </ul>
</div>

CSS代码

body {background: #000;}

div {
    background: rgba(255, 255, 255, .06);
    display: table;
    padding: 15px;
    margin: 50px auto 0;
}

ul {
        display: -webkit-flex;
        display: -ms-flexbox;
    display: flex;
        -webkit-flex-wrap: wrap;
        -ms-flex-flow: row wrap;
    flex-wrap: wrap;
        -ms-flex-pack: center;
        -webkit-justify-content: center;
    justify-content: center;
    list-style: none;
    padding: 0;
}

li {
    background: purple;
    margin: 4px;
}

img {
    display: block;
    height: 40px;
    padding: 7px;
    width: 40px;
}

这似乎是一个IE错误,显示Flex元素的父容器设置为显示:删除此行可以解决问题.但我需要显示:table;将父容器集中.

任何想法如何让IE11包装图像?


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Agile Web Application Development with Yii 1.1 and PHP5

Agile Web Application Development with Yii 1.1 and PHP5

Jeffrey Winesett / Packt Publishing / 2010-08-27

In order to understand the framework in the context of a real-world application, we need to build something that will more closely resemble the types of applications web developers actually have to bu......一起来看看 《Agile Web Application Development with Yii 1.1 and PHP5》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具