将 figcaption 垂直居中放置在图像旁边?

Position figcaption vertically centered and next to image?

我在 figure 标签中有一张图片和一个标题。我想知道如何让 figcaption 位于 img 旁边并垂直居中,就像所附的图像一样。

这是我设置的jsfiddle

谢谢!

给你,只需将 css 替换为以下内容:

html { font-family: 'Helvetica-Neue', Arial, Helvetica; font-size: 1em; line-height: 1.4; letter-spacing: 1px; color:white; }
figure { float:left; padding:20px; display:block; background:#ffa2df; position:relative; }
.width { width:50%; }
.height { height:15em; }
img { width:auto; height:100%; float:left;}
figcaption { background:#5800ff; height:100%; display:flex; justify-content: center;
flex-direction: column;
text-align: center; 
float:left; 
}