使用HTML,我如何可以直接对齐文本下的图像?

使用HTML,我如何可以直接对齐文本下的图像?如果您正在布局照片,并希望在每个照片下面都有文字,我建议做一个无序列表,并在每个列表项元素中插入图片和段落文本。它看起来是这样的:

<ul>
<li><img src="beginnermensimage.jpg"><p>Beginner mens image</p></li>
<li><img src="advancedmensimage.jpg"><p>Advanced mens image</p></li>
</ul>

最简单的方式对齐文字直接下一个图像是:

<style>
img{
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
h2{
font-size: 18px;
font-weight: 200;
text-align: center;
}
</style>
<div class="container">
<img src="teammeating.jpg">
<h2>Lorem ipsum dolor sit amet sed do eiusmod tempor.</h2>
</div>

使用HTML,我如何可以直接对齐文本下的图像?

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注