html - 图像和边框之间的空间
问题描述
为什么会有空间?我该如何解决?请帮我。
<div class="person-Description">
<img src="Person.png" alt="Danielle Harris">
<h1>Danielle Harris</h1>
<h3>Software Technician</h3>
</div>
.person-Description{
display: inline-flex; flex-direction: column;
width: 100%; align-self: flex-start; text-align: center;
align-items: center; justify-content: center;
}
.person-Description img{
display: block; width: 60%; user-select: none;
border-radius: 30px; border: 5px solid #FFFFFF;
}
解决方案
I assume that you mean the small space between the image itself and the border, which can hardly be seen. To fix this issue, you have to add a background color to the image. The background color should be the same color as your border. This way, the little space will disappear visually. So in your case, simply add background: #ffffff;
to your CSS rule .person-Description img
.
.person-Description{
display: inline-flex; flex-direction: column;
width: 100%; align-self: flex-start; text-align: center;
align-items: center; justify-content: center;
}
.person-Description img{
display: block; width: 60%; user-select: none;
border-radius: 30px; border: 5px solid #FFFFFF;
background: #ffffff;
}
<div class="person-Description">
<img src="Person.png" alt="Danielle Harris">
<h1>Danielle Harris</h1>
<h3>Software Technician</h3>
</div>
推荐阅读
- reactjs - 一个全新的 17.0.2 项目有这么多反应漏洞是有原因的吗?
- python - Python:如何在不破坏文件结构和样式的情况下修改 XLSX 中的特定单元格?
- kubernetes - 当一个 pod 资源限制没有超过,而单个容器的资源限制超过了,会发生什么?
- mysql - pymysql.err.InterfaceError: (0, '') 在多线程 python 中执行多个查询时出错
- json - 过滤:包含 Json 对象数组的 Json
- python - python中的时间戳格式
- python - Slack API:rtm.start 有效,但 rtm.connect 在 slack_sdk.rtm_v2 中无效
- python - 如何简化“二十一点”函数以提高效率?简单的语法/函数效率查询
- bash - 我想在 bash 中将变量分配给用逗号分隔的输入
- java - 如何将缓存中存储的数据用于springboot中的另一个功能