gpt4 book ai didi

html - 在html中插入图像后写入文本

转载 作者:行者123 更新时间:2023-11-28 00:33:04 26 4
gpt4 key购买 nike

我试图在 html 页面上的图像下方写描述,但文本自动对齐到图像的右侧。我是初学者,请帮助!提前致谢!

.images {
margin-left: auto;
margin-right: auto;
width: 40%;
}

#my_freaking_id {
color: red;
font-size: 50px;
}
<h1>Pictures</h1>
<div class="images">
<img src="https://picsum.photos/200/200?random">
<p>Image 1</p>
</div>
<div class="images">
<img src="https://picsum.photos/200/200?random">
<p>Image 2</p>
</div>

<div id="my_freaking_id">
It has been a long day, without you my friend and I will tell you all about it when I see you again!<br>I hope our friendship lasts forever!
</div>

最佳答案

也许只是添加到 css?

.images img, .images p {
display:block;
}

关于html - 在html中插入图像后写入文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54302780/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com