html - 如何在 P 标签中将文本与图像居中
问题描述
我正在尝试将文本与照片的中心对齐。然而,图像被包裹在一个 P 标签上。关于如何居中的任何想法?
我想要的是:
代码:
HTML:
<div class="customerreviewcontent">
<div><em>"Omnifood is just awesome! I just launched a <br> startup which leaves me with no time for <br> cooking, so Omnifood is a life-saver. Now <br> that I got used to it, I couldn't live without my daily meals!"</em>
<p ><img src="resources/css/img/customer-1.jpg" style="border-radius: 15px; height: 40px;" alt=""> Albert Duncon</p>
</div>
<div><em>"Inexpensive, healthy and great-tasting meals,<br> delivered right to my home. We have lots <br>of food delivery here in Lisbon, but no one <br> comes even close to Omifood. Me and my <br> family are so in love!"</em>
<p> <img src="resources/css/img/customer-2.jpg" style="border-radius: 15px; height: 40px;" alt=""> Joana Silva</p>
</div>
<div><em>"I was looking for a quick and easy food <br> delivery service in San Franciso. I tried a lot <br> of them and ended up with Omnifood. Best food delivery service in the Bay Area.<br> Keep up the great work!"</em>
<p><img src="resources/css/img/customer-3.jpg" style="border-radius: 15px; height: 40px;" alt="">Milton Chapman</p>
</div>
</div>
解决方案
添加vertical-align: middle;
图像
推荐阅读
- docker - 码头集装箱内关闭的端口
- javascript - 当您到达滚动时的原始位置时,将位置从固定到最底部切换到 div 的初始位置
- c++ - 无法使用 QMediaPlayer 加载音乐文件
- python - 对象没有属性时如何处理错误
- elasticsearch - ElasticSearch 高级 REST 客户端 7.0.1:方法 `AcknowledgedResponse.fromXContent` 不存在
- typescript - 为什么有时 TSDoc 中最顶部的注释没有显示在生成的文档中?
- docker - Docker挂载一个空目录
- javascript - 如何解决:数组索引超出范围
- sql - 如何从 SAS 将空白值(而不是 NULL)插入 SQL Server
- jenkins - 通过 Jenkins 构建/部署 Vue.js 项目