我想問我如何將我的標題與我的圖像對齊,我有一個非常長的文字。可能嗎?如何將字幕與圖像對齊?
<figure>
<img src="https://placeholdit.imgix.net/~text?txtsize=33&txt=330%C3%97180&w=330&h=180">
<figcaption>Adjusting to school is a noteworthy move in a youthful grown-up's life. For some, the move incorporates moving out of the family home surprisingly, making new companions, and confronting expanded academic demands.
</figcaption>
</figure>
CSS
figure {
display: inline-block;
margin: 20px;
}
figure img {
vertical-align: top;
}
figure figcaption {
text-align: center;
}
上面的代碼導致此;
I COULDN'T UPLOAD IT BECAUSE IT SAYS I NEED 10 REPS TO POST IMAGES, I'M VERY VERY SORRY
請添加一個JSFiddle,以便我們可以看到代碼輸出並對其進行自定義。 – Nieck
這裏使用figure和figcaption更加語義化,將其改爲使用div並不理想。 –