对齐项目我有了div的里面垂直内浮动DIV是里面李
<ul>
<li>
<div class="date">today</div>
<div class="desc">lorem ipsum</div>
<div class="action">
<p>
<a class="button">X</a>
</p>
</div>
</li>
<li>....</li>
<li>....</li>
</ul>
我怎么能垂直对齐内div.action是a.button名单?通过使用与Susy产生
CSS为列表和CSS看起来是这样的:
ul {
list-style: none outside none;
}
li {
margin-left: 12.766%;
margin-right: 12.766%;
margin-bottom: 10px;
background-color: #eee;
display: block;
}
li:after {
clear: both;
content: "";
display: table;
}
.date {
float: left;
margin-right: 2.12766%;
width: 10.6383%;
}
.desc {
float: left;
margin-right: 2.12766%;
width: 74.4681%;
}
.action {
float: right;
text-align: center;
margin-right: 0;
width: 10.6383%;
}
我不知道李高度,因为“说明”文本可以是任意长度。
这里是codepen.io代码 - >http://codepen.io/anon/pen/CFhos
任何'float'ed会自动上升到其包含块的顶部。如果你想让它垂直居中,你将不得不使用对齐右侧按钮的不同方法。 – 2014-09-29 08:16:47