如何删除元素之间的边距

how to remove margin between elements

我确实有一个 div 有图像,另一个 div 有 h4 和 p 标签。将flex赋值给parent后div,h4和p标签有边距无法消除。

绿色标记的地方必须消除

代码:

<div className={styles.profile}>
      <div>
        <img
          src="https://www.thesprucepets.com/thmb/sfuyyLvyUx636_Oq3Fw5_mt-PIc=/3760x2820/smart/filters:no_upscale()/adorable-white-pomeranian-puppy-spitz-921029690-5c8be25d46e0fb000172effe.jpg"
          alt="sai"
        />
      </div>
      <div className={styles.profile__name}>
        <h4>TEST USER</h4>
        <p>Premium Member</p>
      </div>
    </div>

风格:

.profile {
  display: flex;
  align-items: center;
  justify-content: center;
  img {
    width: 50px;
    height: 50px;
    border-radius: 100%;
    object-fit: cover;
    filter: drop-shadow(0px 1px 32px rgba(234, 19, 19, 0.45));
  }
}

我尝试将 margin:0 赋值给 .profile__name,但边距仍然存在。

尝试在 h4p 标签上添加 margin: 0;

.profile h4, .profile p{
    margin: 0;
}