我正在嘗試製作一個小段,在其左側有一個圖像,文本垂直居中在圖像的右側。對於下面的第二張圖片,我需要右側的圖像,文本垂直居中在圖像的左側。你如何垂直居中文本與div元素中的圖像?
<div id="Segment2">
<h2>Fig Tree is a discussion tool that helps organizations innovate</h2>
<h3>We took the basics of a discussion thread and added...</h3>
<div style="height:259px;" id="Branching">
<section class=LeftBoundPic>
<h4>Discussion Branching</h4>
<img src="SomePhoto.png" alt="FigTree"/>
</section>
<span>
Bunch of text <br>
that should be next to the image.
</span>
</div>
<div style="height: 259px; margin-top: 50px;" id="ContentHubs">
<section class=RightBoundPic>
<h4>Content Hub</h4>
<img src="SomePhoto.png" alt="FigTree"/>
</section>
<span>
More text that should <br>
be on the left of the photo now.
</span>
</div>
</div>
這是它的HTML部分,但我不能想出一種方式來與CSS樣式。
corect你的代碼,它應該是'垂直對齊:中間;' –