【发布时间】:2015-06-09 09:54:45
【问题描述】:
我正在尝试显示一个由 CSS 居中并调整大小的图像(max-width / max-height, flex)。
这在 Chrome 中运行良好,但在 Firefox 中则不行。怎么了?
a {
border: 1px solid red;
display: flex;
height: 100px;
width: 100px;
justify-content: center;
align-items: center;
box-sizing: border-box;
padding: 5px;
}
img {
max-width: 100%;
max-height: 100%;
border: 1px solid green;
}
<a class="frame">
<img src="http://placehold.it/500x150"/>
</a>
【问题讨论】: