有人可以告诉我为什么我创建的flexbox没有将三个子div(图像,内容和动作)垂直划分为相同的大小? 插件在这里:
http://plnkr.co/edit/zqdpqnV7QkKrx7lm1Tsi?p=preview
CSS:
.card {
position: relative;
z-index: 2;
box-shadow: 0 0.1rem 0.2rem #aaa;
background: #fff;
border-radius: 0.2rem;
margin: 0.5rem 0 1rem 0;
height: 10rem;
display: flex;
flex-direction: column;
}
.card.sm {
height: 10rem;
}
.card.sm .card-action {
padding: 0.5rem;
}
.card.md {
height: 20rem;
}
.card.md .card-action {
padding: 1rem;
}
.card.lg {
height: 30rem;
}
.card.lg .card-action {
padding: 1.5rem;
}
.card .card-content {
padding: 1rem;
flex: 1 1 auto;
overflow-y: scroll;
}
.card .card-content .card-title {
font-weight: bold;
font-size: 1.1rem;
}
.card .card-action {
flex: 1 1 auto;
padding: 1rem;
border-top: 0.1rem solid rgba(160, 160, 160, 0.2);
text-transform: uppercase;
}
.card .card-image {
position: relative;
flex: 1 1 auto;
}
.card .card-image img {
border-radius: 2px 2px 0 0;
position: relative;
left: 0;
right: 0;
top: 0;
bottom: 0;
width: 100%;
}
HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<div style="width:30rem">
<div class="card md">
<div class="card-image">
<img src="http://images.freeimages.com/images/previews/8fe/sky-above-the-black-mountains-1402912.jpg"/>
</div>
<div class="card-content">
<span class="card-title">Title</span>
<p>Some content</p>
</div>
<div class="card-action">
<a href="#">This is a link</a>
</div>
</div>
</div>
</body>
</html>