我想讓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