我是 HTML 和 CSS 新手。
我试图从 H1 中删除顶部和底部边距,但默认边距仍然保留。
到目前为止我的 CSS 如下所示:
font-family: 'Cormorant Garamond';
font-size: 65px;
letter-spacing: 40px;
color: white;
text-align: center;
我还尝试了以下每一项:
margin: none;
margin-top: none;
margin-top: 0px;
margin-top: 0%;
margin: 0;
保留默认边距。
有人知道为什么会这样吗?
确保 h1 元素上没有填充,也许有一些填充可能显示为边距。因此尝试将顶部和底部内边距设置为 0。 h1{填充:0} 或者 h1{顶部填充:0; 底部填充:0}.
也请检查一下:h1 元素不需要的上边距