【发布时间】:2018-10-16 17:07:07
【问题描述】:
我有这种情况:
<div class="slot_twoimages">
<article class="slot image">
<img src="https://via.placeholder.com/560x441" />
</article>
<article class="slot image">
<img src="https://via.placeholder.com/560x441" />
</article>
<article class="slot text">
<div class="headline">HEADLINE</div>
</article>
采用这种风格:
.slot_twoimages {
height: auto;
background-image: linear-gradient(120deg, yellow, pink);
display: flex;
flex-wrap: wrap;
justify-content: center;
align-content: center;
.slot.image {
//margin: 121px 40px 64px;
display: inline-block;
flex: 50%;
//DA RIMUOVERE
img {
max-width: 560px;
max-height: 441px;
}
}
.slot.text {
width: 100%;
display: block;
text-align: center;
margin: 0 30% 88px;
margin-bottom: 88px;
.headline {
font-size: 29px;
margin-bottom: 50px;
letter-spacing: -0.015em;
padding-top: 24px;
padding-bottom: 10px;
}
}
}
现在,我想使用 flexbox 将两个图像居中,并且我需要将两个图像下方的插槽文本居中。我需要将图像保持在同一位置,并且有必要进行图像缩放。我无法修改 DOM。
【问题讨论】:
-
图像居中是什么意思?
-
我想将图像居中放入他的容器中。