html - 如何摆脱按钮中的这个幻像元素
问题描述
<button onClick={onDropdownClick} className="menu-trigger">
<img
className="google-profile-photo"
src={currentUser.photoURL}
alt="User Avatar"
/>
<span>
<ArrowDown />
</span>
</button>
我希望 img 标签和 span 彼此相邻,中间没有空格。我无法摆脱中间的这个空白。有谁知道怎么做?
.menu-trigger {
display: flex;
width:auto;
min-height: 5rem;
position: relative;
background: white;
border-radius: 0.3rem;
cursor: pointer;
display: flex;
justify-content: space-between;
align-items: center;
padding: 4px 6px;
box-shadow: 8px 16px 5rem #eeeeee;
vertical-align: middle;
transition: box-shadow 0.4s ease;
margin-top: 1rem;
border: none;
}
.google-profile-photo {
border-radius: 50%;
margin: 2%;
width: 50%;
height: 100%;
}
解决方案
用这个:
justify-content: center;
这是你的第二个问题:
background-size: cover
推荐阅读
- react-native - React Native 和 Flutter 之间的更好选择(Dart)
- wordpress - htaccess 301 仅重定向根目录,但排除所有文件和子文件夹,但有例外
- php - nginx 不为 ingress-nginx 后面的 PHP 应用程序提供 JS、CSS 文件
- ruby-on-rails - 从 ruby gem firebase 实时数据库中过滤数据
- c# - NEST Elastic Search - 用空格查询一个词
- amazon-web-services - Cron 表达式 Aws 在 EventBridge(Cloudwatch 触发器)启用后每 5 分钟运行一次
- c - 寻找使用互斥线程的例子
- c# - 将登录用户分配给 FormView 控件内的文本框
- github - 在 GitHub 操作下运行时将多个 cmake 库目标组合成一个目标失败
- python - 如何编辑我的 postgreSQL 查询以按日期选择几列的最新行