【发布时间】:2015-05-07 12:59:11
【问题描述】:
我想使用 flex 布局将三个图像排列成一排,对齐,并在它们之间分配任何额外的空间。问题是,我希望图像能够响应。以下适用于 Chrome 但不适用于 IE10:
$('head style[type="text/css"]').attr('type', 'text/less');
less.env = 'development';
less.refreshStyles();
body {
margin: 0;
}
.flex() {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.flex-justify(@justifyStyle) {
.ms-flex-justify(@justifyStyle);
-webkit-justify-content: @justifyStyle;
justify-content: @justifyStyle;
}
.ms-flex-justify(@msJustify) when (@msJustify = space-between) {
-ms-flex-pack: justify;
}
.ms-flex-justify(@msJustify) when (@msJustify = space-around) {
-ms-flex-pack: distribute;
}
.ms-flex-justify(@msJustify) when (@msJustify = flex-end) {
-ms-flex-pack: end;
}
.ms-flex-justify(@msJustify) when (@msJustify = flex-start) {
-ms-flex-pack: start;
}
.ms-flex-justify(@msJustify) when (@msJustify = center) {
-ms-flex-pack: center;
}
#content {
background-image: url(//dummyimage.com/900x300/ccf/f);
background-position: center;
background-repeat: repeat-x;
background-size: auto 100%;
.flex();
.flex-justify(space-between);
& > div {
& > img {
height: auto;
opacity: 0.5;
vertical-align: bottom;
width: 100%;
}
}
}
<div id="content">
<div><img src="//dummyimage.com/300/99f/f" /></div>
<div><img src="//dummyimage.com/300/99f/f" /></div>
<div><img src="//dummyimage.com/300/99f/f" /></div>
</div>
Here's 一个合适的小提琴。在 IE10 中是否可以使用带有响应式图像的 flex 布局?
【问题讨论】:
标签: css responsive-design flexbox