我想让3个内容垂直出现在div的中心。我用vertical-align:middle
,但它没有做我想做的事情。我怎样才能解决这个问题?垂直对齐div中的中心
我想让home_post_time
出现在垂直居中的右侧角落。我尝试过float:right;
,但无法做到我想要的。这是我希望它出现
Image
Image text time
Image
.home_post_sections {
width: 100%;
height: 33%;
background-color: #01ff70;
text-align: left;
}
.home_post_propic {
width: 55px;
height: 55px;
margin-top: 5px;
margin-left: 5px;
margin-bottom: 5px;
}
.home_post_username {
margin-left: 20px;
width: 100%;
vertical-align: middle;
}
.home_post_time {
float: right;
vertical-align: middle;
text-align: right;
margin-right: 10px;
}
<div className="home_post_sections">
<img src="http://lorempixel.com/output/people-q-c-55-55-9.jpg" className="home_post_propic" />
<a className="home_post_username">User name</a>
<a className="home_post_time">23h</a>
</div>
创建一个plunkr。 –
@ManojLodhi没有 - 在这里创建一个片段!就像我使用'<>'按钮 – mplungjan
[垂直对齐图像旁边的文本?](http://stackoverflow.com/questions/489340/vertically-align-text-next-to-an-图像) – mplungjan