html - 在html中插入图像后编写文本
问题描述
我正在尝试在 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;
}
推荐阅读
- reactjs - 如何正确防止子项在更改值上重新呈现?
- javascript - 从 JSON / CSV 加载内容并使用 basil.js 使文本框适合内容
- python - Python函数不返回None而不是元组列表
- python - 如何将添加字符串应用到数据框子集的列
- documentation - 哪里可以获得关于 dm 脚本函数的详细文档
- azure-functions - 读取文本文件并将内容发送到 Azure 数据工厂中的 Azure 函数
- typescript - Vue.js - vue-cli-service 服务 - img src 没有从对象正确加载
- c - 静态结构警告空声明中无用的存储类说明符
- scala - 使用 .csv 扩展名在 azure blov 中保存一个空数据框
- angular - Http 调用不会发送 cookie