答案 0 :(得分:1)
您希望使用align-items
和align-self
来实现此目的:http://codepen.io/anon/pen/qbyBOd
代码转储:
<div class="container">
<div>1</div>
<div>2</div>
</div>
.container {
display: flex;
width: 200px;
height: 100px;
align-items: flex-start;
}
.container div {
flex: 1;
border: 2px solid red;
background: gray;
}
.container div:nth-child(2) {
flex: 1;
align-self: stretch;
}
答案 1 :(得分:0)
align-self
是一个很好的喊叫
html,
body {
height: 100%;
}
body {
margin: 0;
}
.container {
height: 100%;
display: flex;
justify-content: center;
}
.child1 {
background-color: #e67e22;
align-self: flex-start;
}
.child2 {
background-color: #3498db;
align-self: stretch;
}
<div class="container">
<div class="child1">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequuntur, voluptatibus.</div>
<div class="child2">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deleniti, vel!</div>
</div>