(第一次使用Stack Overflow,如果我发现任何严重的社交错误,请告诉我)
I've created a fiddle here of what I've been working on so far https://jsfiddle.net/95b18u9q/#&togetherjs=RmHEgrjOCG
这就是我想要的:
以下是导致问题的原因:
我已经找到了一些修正,但它们会导致问题。
HTML
<div class="pricing-container">
<div class="item-container" >
<div class="item-header">Column 1</div>
<div class="item-description">
<ul>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
</ul>
</div>
<!-- The longest column needs position: relative. All others do not. -->
<div class="item-footer" style="position: relative;">NewRegister</div>
</div>
<div class="item-container" >
<div class="item-header">Column 2</div>
<div class="item-description">
<ul>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
</ul>
</div>
<div class="item-footer" style="">NewRegister</div>
</div>
<div class="item-container">
<div class="item-header">Column 3</div>
<div class="item-description">
<ul>
<li>List Item</li>
<li>List Item</li>
</ul>
</div>
<div class="item-footer" style="">NewRegister</div>
</div>
</div>
CSS:
.pricing-container {
padding: 0;
margin: 0;
list-style: none;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-flow: row wrap;
justify-content: space-around;
align-items:stretch;
}
.item-container {
background: tomato;
padding: 5px;
width: 200px;
margin-top: 10px;
color: white;
font-weight: bold;
font-size: 12px;
text-align: center;
align-items:stretch;
position:relative;
align:row;
width:33%
}
.item-header {
background-color:gray;
}
.item-description{
width:90%;
}
.item-footer {
background: pink;
padding: 10px;
width: 80%;
margin-top:20px;
margin-left:10px;
margin-right:10px;
margin-bottom: 20px;
color: white;
font-weight: bold;
font-size: 12px;
text-align: center;
position: absolute;
bottom:0;
}
@media(min-width:787px) {
.item-container{
width:33%
}
}
@media(max-width:786px) {
.item-container{
width:100%
}
}
答案 0 :(得分:0)
我认为这会勾勒出你想要的大部分盒子。
.pricing-container {
padding: 0;
margin: 0;
list-style: none;
display: flex;
justify-content: space-around;
}
.item-container {
background: tomato;
padding: 5px;
flex: 1 0 200px;
margin: 10px;
color: white;
font-weight: bold;
font-size: 12px;
text-align: center;
display: flex;
flex-direction: column;
}
.item-header {
background-color: gray;
}
.item-description {
width: 90%;
margin: auto;
flex: 1;
}
ul {
list-style-type: none;
padding: 0;
}
.item-footer {
background: pink;
padding: 10px;
width: 80%;
margin: auto;
color: white;
font-weight: bold;
font-size: 12px;
text-align: center;
align-self: flex-end;
}
@media screen and (max-width: 600px) {
.pricing-container {
flex-direction: column;
}
.item-container {
flex: 0;
}
.item-description {
flex: 0;
}
.item-footer {
align-self: flex-start;
}
}
&#13;
<div class="pricing-container">
<div class="item-container">
<div class="item-header">Column 1</div>
<div class="item-description">
<ul>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
</ul>
</div>
<!-- The longest column needs position: relative. All others do not. -->
<div class="item-footer" style="position: relative;">NewRegister</div>
</div>
<div class="item-container">
<div class="item-header">Column 2</div>
<div class="item-description">
<ul>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
<li>List Item</li>
</ul>
</div>
<div class="item-footer" style="">NewRegister</div>
</div>
<div class="item-container">
<div class="item-header">Column 3</div>
<div class="item-description">
<ul>
<li>List Item</li>
<li>List Item</li>
</ul>
</div>
<div class="item-footer" style="">NewRegister</div>
</div>
</div>
&#13;